|
|
@@ -34,42 +34,23 @@ class Test
|
|
|
|
|
|
|
|
|
//取消寄售
|
|
|
- public function copy_user(ProductTransfer $productTransfer, ProductOrder $productOrder, MarketLogic $marketLogic)
|
|
|
+ public function copy_user(ProductTransfer $productTransfer, ProductOrder $productOrder, UserModel $userModel)
|
|
|
{
|
|
|
|
|
|
- $list = $productTransfer::where('status', ProductTransfer::Normal)->where('order_no', '')->select();
|
|
|
-
|
|
|
+ $list = $productOrder::where('type_id', 3)->where('order_id', 0)->group('user_id')->select();
|
|
|
+ $is_super = 1; //1新人福利, 2超级福利
|
|
|
$i = 0;
|
|
|
foreach ($list as $item) {
|
|
|
- $check_pro = $productOrder
|
|
|
- ->where('id', $item['order_id'])
|
|
|
- ->find();
|
|
|
- if (!empty($check_pro)) {
|
|
|
- if($check_pro['type_id'] == 1 && $check_pro['status'] == 2){
|
|
|
- $i++;
|
|
|
- //取消转让订单
|
|
|
- $productOrder->where('id', $item['order_id'])->update(['status'=> 1]);
|
|
|
-
|
|
|
- //修改:类型状态
|
|
|
- $item->status = 0;
|
|
|
- $item->save();
|
|
|
- }elseif($check_pro['type_id'] == 1 && $check_pro['status'] == 4){
|
|
|
- //修改:类型状态
|
|
|
- $item->status = 0;
|
|
|
- $item->save();
|
|
|
- }
|
|
|
- else{
|
|
|
- dump('订单:' . $item['order_id'] . '的type_id为:' . $check_pro['type_id'] . ',status为:' . $check_pro['status']);
|
|
|
- }
|
|
|
- }else{
|
|
|
- dump('订单:' . $item['order_id'] . '无此订单');
|
|
|
- }
|
|
|
+ $i++;
|
|
|
+ //取消转让订单
|
|
|
+ $userModel->where('id', $item['user_id'])->update(['is_super'=> $is_super]);
|
|
|
}
|
|
|
dump('完成了' . $i . '个订单');
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- * 更新上级
|
|
|
+ * 更新上级 SELECT * FROM product_order where order_id in ( SELECT MAX( order_id ) FROM product_order GROUP BY type_id )
|
|
|
+
|
|
|
*/
|
|
|
public function change_parent()
|
|
|
{
|