|
@@ -2,12 +2,15 @@
|
|
|
|
|
|
|
|
namespace app\admin\command;
|
|
namespace app\admin\command;
|
|
|
|
|
|
|
|
|
|
+use app\admin\controller\user\User;
|
|
|
use think\console\Command;
|
|
use think\console\Command;
|
|
|
use think\console\Input;
|
|
use think\console\Input;
|
|
|
use app\admin\model\Importregion;
|
|
use app\admin\model\Importregion;
|
|
|
|
|
+use app\common\model\ProductOrder;
|
|
|
use think\console\Output;
|
|
use think\console\Output;
|
|
|
use think\Exception;
|
|
use think\Exception;
|
|
|
use app\common\model\Region;
|
|
use app\common\model\Region;
|
|
|
|
|
+use app\common\model\UserPledge;
|
|
|
|
|
|
|
|
class Task extends Command
|
|
class Task extends Command
|
|
|
{
|
|
{
|
|
@@ -65,30 +68,33 @@ class Task extends Command
|
|
|
//地区导出格式 140213 平城区 140214 云冈区
|
|
//地区导出格式 140213 平城区 140214 云冈区
|
|
|
public function execute(Input $input, Output $output){
|
|
public function execute(Input $input, Output $output){
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- $reg = new Region();
|
|
|
|
|
- $imreg= new Importregion();
|
|
|
|
|
- $list = $reg::where('parent_id', '=', 140214)->chunk(1000, function($users) use($reg, $imreg) {
|
|
|
|
|
- foreach ($users as $user) {
|
|
|
|
|
-
|
|
|
|
|
- switch ($user->level) {
|
|
|
|
|
-
|
|
|
|
|
- case 4:
|
|
|
|
|
- $san = $reg::where('id', $user->parent_id)->find();
|
|
|
|
|
- $two = $reg::where('id', $san->parent_id)->find();
|
|
|
|
|
- $one = $reg::where('id', $two->parent_id)->find();
|
|
|
|
|
- $imreg::insert(['name'=> $one->name.'-'.$two->name.'-'.$san->name.'-'.$user->name, 'com_id'=>$one->id.'-'.$two->id.'-'.$san->id.'-'.$user->id, 'level'=>4]);
|
|
|
|
|
- break;
|
|
|
|
|
- // 更多的 case 语句
|
|
|
|
|
- default:
|
|
|
|
|
- echo "level error";
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- //
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ //
|
|
|
|
|
+ $rows = UserPledge::where('status', '>', 0)->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();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|