123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- use app\model\Medal;
- class UpdateMedalData extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $data = [
- ['title'=>10 ,'content'=>'累计学完10门课程','type'=>'class','condition'=>10 ,'remark'=>'学完课程' ,'path'=>'Train/62ba60a96f83f.png'],
- ['title'=>20 ,'content'=>'累计学完20门课程','type'=>'class','condition'=>20 ,'remark'=>'学完课程' ,'path'=>'Train/62ba60c50d98b.png'],
- ['title'=>30 ,'content'=>'累计学完30门课程','type'=>'class','condition'=>30,'remark'=>'学完课程' ,'path'=>'Train/62ba60df3e500.png'],
- ['title'=>'达人','content'=>'累计学完50门课程','type'=>'class','condition'=>50 ,'remark'=>'能力提升' ,'path'=>'Train/62ba60f84498b.png'],
- ['title'=> 10,'content'=>'累计获客10人','type'=>'clue','condition'=>10 ,'remark'=>'客户浏览' ,'path'=>'Train/62ba61209fae7.png'],
- ['title'=> 30,'content'=>'累计获客30人','type'=>'clue','condition'=>30 ,'remark'=>'客户浏览' ,'path'=>'Train/62ba6145ce4db.png'],
- ['title'=> 60,'content'=>'累计获客60人','type'=>'clue','condition'=> 60,'remark'=>'客户浏览' ,'path'=>'Train/62ba6163f1853.png'],
- ['title'=> '达人','content'=>'累计获客90人','type'=>'clue','condition'=> 90,'remark'=>'品牌触达' ,'path'=>'Train/62ba6189473ce.png'],
- ['title'=> 10,'content'=>'累计回答10条','type'=>'comment','condition'=> 10,'remark'=>'话术回答' ,'path'=>'Train/62ba61b06db1e.png'],
- ['title'=> 30,'content'=>'累计回答30条','type'=>'comment','condition'=> 30,'remark'=>'话术回答' ,'path'=>'Train/62ba61d87c180.png'],
- ['title'=> 60,'content'=>'累计回答60条','type'=>'comment','condition'=> 60,'remark'=>'话术回答' ,'path'=>'Train/62ba61f4a8315.png'],
- ['title'=> '达人','content'=>'累计回答90条','type'=>'comment','condition'=> 90,'remark'=>'答疑解惑' ,'path'=>'Train/62ba62183c376.png'],
- ['title'=> 7,'content'=>'累计签到7天','type'=>'sign','condition'=> 7,'remark'=>'登录天数' ,'path'=>'Train/62ba623fefad9.png'],
- ['title'=> 30,'content'=>'累计签到30天','type'=>'sign','condition'=> 30,'remark'=>'登录天数' ,'path'=>'Train/62ba625a1aeef.png'],
- ['title'=> 60,'content'=>'累计签到60天','type'=>'sign','condition'=> 60,'remark'=>'登录天数' ,'path'=>'Train/62ba62785bda3.png'],
- ['title'=> '达人','content'=>'累计签到365天','type'=>'sign','condition'=> 365,'remark'=>'系统使用' ,'path'=>'Train/62ba6296e4573.png'],
- ['title'=> 100,'content'=>'累计跟进100次','type'=>'visit_log','condition'=>100 ,'remark'=>'跟进次数' ,'path'=>'Train/62ba62c07c086.png'],
- ['title'=> 300,'content'=>'累计跟进300次','type'=>'visit_log','condition'=> 300,'remark'=>'跟进次数' ,'path'=>'Train/62ba62dd14f38.png'],
- ['title'=> 500,'content'=>'累计跟进500次','type'=>'visit_log','condition'=>500 ,'remark'=>'跟进次数' ,'path'=>'Train/62ba62f881c53.png'],
- ['title'=> '达人','content'=>'累计跟进1000次','type'=>'visit_log','condition'=>1000 ,'remark'=>'客户维护' ,'path'=>'Train/62ba6311a004b.png'],
- ];
- $model = new Medal();
- foreach ($data as $v) {
- $w = [];
- $w[] = ['title','=',$v['title']];
- $w[] = ['content','=',$v['content']];
- $w[] = ['type','=',$v['type']];
- $u = [];
- $u['path'] = $v['path'];
- $model->where($w)->update($u);
- unset($w);
- unset($u);
- }
- }
- }
|