|
|
@@ -8,6 +8,9 @@ use app\common\model\coupon\CouponRules;
|
|
|
use app\common\model\goods\Goods;
|
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
|
use app\common\model\property\PropertyActivity;
|
|
|
+use app\common\model\property\PropertyHead;
|
|
|
+use app\common\model\property\PropertyOrder;
|
|
|
+use app\common\model\property\PropertyUser;
|
|
|
use app\common\model\user\User;
|
|
|
use think\facade\Db;
|
|
|
use think\facade\Log;
|
|
|
@@ -200,6 +203,21 @@ class ActivityLogic extends BaseLogic
|
|
|
if ($result === false) {
|
|
|
throw new \Exception('生成代理单失败');
|
|
|
}
|
|
|
+ }else{
|
|
|
+ //判断当前用户是否是物业代理用户
|
|
|
+ $property_user = PropertyUser::where(['user_id'=>$params['user_id']])->findOrEmpty();
|
|
|
+ if(!$property_user->isEmpty()){
|
|
|
+ $property_order = PropertyOrder::where(['property_user_id'=>$property_user['id'],'order_status'=>0,'work_id'=>0])->findOrEmpty();
|
|
|
+ if(!$property_order->isEmpty()){
|
|
|
+ $property_head = PropertyHead::where('id',$property_order->property_head_id)->findOrEmpty();
|
|
|
+ if(!$property_head->isEmpty() && (((time()-strtotime($property_order['create_time']))<=($property_head['bind_date']*24*3600)) || ($property_head['bind_date']==0))){
|
|
|
+ //绑定物业代理
|
|
|
+ $property_order->work_id = $serviceOrder['work_id'];
|
|
|
+ $property_order->order_status = 1;
|
|
|
+ $property_order->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return true;
|