| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace app\admin\command;
- use app\admin\controller\user\User;
- use think\console\Command;
- use think\console\Input;
- use app\admin\model\Importregion;
- use app\common\model\ProductOrder;
- use think\console\Output;
- use think\Exception;
- use app\common\model\Region;
- use app\common\model\UserPledge;
- class Task extends Command
- {
- protected function configure()
- {
- $this->setName('task')->setDescription('Compress js and css file');
- }
-
- protected function execute1(Input $input, Output $output)
- {
- $reg = new Region();
- $list = $reg::where('level', '=', 1)->column('id,name');
- $arr = array();
- $i = 0;
- foreach ($list as $key => $item) {
- $arr[$i]['label'] = $item;
- $arr[$i]['id'] = $key;
- $list1 =$reg::where('parent_id', '=', $key)->column('id,name');
- $j = 0;
- foreach ($list1 as $key1 => $item1) {
- $arr[$i]['children'][$j]['label'] = $item1;
- $arr[$i]['children'][$j]['id'] = $key1;
- $list2 =$reg::where('parent_id', '=', $key1)->column('id,name');
- $s = 0;
-
- foreach ($list2 as $key2 => $item2) {
- $arr[$i]['children'][$j]['children'][$s]['label'] = $item2;
- $arr[$i]['children'][$j]['children'][$s]['id'] = $key2;
- $list3 =$reg::where('parent_id', '=', $key2)->column('id,name');
- $d = 0;
- foreach ($list3 as $key3 => $item3) {
- if(!empty($item3)){
- $arr[$i]['children'][$j]['children'][$s]['children'][$d]['label'] = $item3;
- $arr[$i]['children'][$j]['children'][$s]['children'][$d]['id'] = $key3;
- $d += 1;
- }
-
- }
- $s +=1;
- }
- $j +=1;
- }
- $i +=1;
- }
- file_put_contents('./11.txt', json_encode($arr, JSON_UNESCAPED_UNICODE));
- $output->info("Ok Successed!");
- }
-
- //山西省-大同市-平城区
- //地区导出格式 140213 平城区 140214 云冈区
- public function execute(Input $input, Output $output){
- //
- $rows = UserPledge::where('status', '=', 1)->select();
- $model = new ProductOrder();
- foreach ($rows as $row) {
- //修改详情
- $detail = json_decode($row['details'], true);
-
- foreach ($detail as &$item) {
- $item['id'] = $model::where('order_no', '=', $item['order_no'])->value('id');
- //修改订单状态
- if($row['user_id'] == 1073 && $row['status'] == UserPledge::Remove){
- $model::where('id', '=', $item['id'])->setField('status', ProductOrder::Paid);
- }
-
- }
- $row->details = json_encode($detail, JSON_UNESCAPED_UNICODE);
- $row->save();
- }
-
- }
- }
|