Commit ae240936 authored by hujun's avatar hujun

推送

parent f13969a3
...@@ -32,10 +32,11 @@ class CouponService{ ...@@ -32,10 +32,11 @@ class CouponService{
* @param int $user_id * @param int $user_id
* @param int $invitee_id * @param int $invitee_id
* @param int $type * @param int $type
* @param int $first_show
* @return mixed * @return mixed
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function sendCoupon(int $user_id, int $invitee_id,int $type) { public function sendCoupon(int $user_id, int $invitee_id,int $type, $first_show = 0) {
$result['status'] = 'successful'; $result['status'] = 'successful';
$result['msg'] = '发券成功'; $result['msg'] = '发券成功';
$result['data'] = []; $result['data'] = [];
...@@ -70,6 +71,7 @@ class CouponService{ ...@@ -70,6 +71,7 @@ class CouponService{
$save_data['invitee_id'] = $invitee_id; $save_data['invitee_id'] = $invitee_id;
} }
$save_data['status'] = 0; $save_data['status'] = 0;
$save_data['first_show'] = $first_show;
$save_data['create_time'] = date('Y-m-d H:i:s'); $save_data['create_time'] = date('Y-m-d H:i:s');
$this->m_coupon->startTrans(); $this->m_coupon->startTrans();
$coupon_untils = new CouponNoEncodingUntils(); $coupon_untils = new CouponNoEncodingUntils();
......
...@@ -33,7 +33,7 @@ class PushClientService ...@@ -33,7 +33,7 @@ class PushClientService
* @param int $operation_id * @param int $operation_id
* @return bool * @return bool
*/ */
public function record(int $report_id, int $order_id, int $type, $message,int $operation_id) public function record(int $report_id, int $order_id, int $type, $message,int $operation_id, $addressee_id = 0)
{ {
$order = new OrderModel(); $order = new OrderModel();
...@@ -42,6 +42,10 @@ class PushClientService ...@@ -42,6 +42,10 @@ class PushClientService
$report = new OReportModel(); $report = new OReportModel();
$user_id = $report->getFieldValue('user_id', ['id'=>$report_id]); $user_id = $report->getFieldValue('user_id', ['id'=>$report_id]);
if (empty($user_id)) {
$user_id = $addressee_id;
}
if (empty($message)) { if (empty($message)) {
$m_agent = new AAgents(); $m_agent = new AAgents();
$message = $m_agent->getAgentsById($operation_id, 'name'); $message = $m_agent->getAgentsById($operation_id, 'name');
...@@ -70,6 +74,16 @@ class PushClientService ...@@ -70,6 +74,16 @@ class PushClientService
$type = 'evaluate'; $type = 'evaluate';
$content = '同联商业邀请您评价经纪人'.$v['message'].'对商铺的带看服务'; $content = '同联商业邀请您评价经纪人'.$v['message'].'对商铺的带看服务';
break; break;
case 1:
$title = "新人专享返现红包";
$type = 'first_login';
$content = $v['message'];
break;
case 2:
$title = "邀请成交返现红包";
$type = 'referrer_coupon';
$content = $v['message'];
break;
} }
$this->pushAgentAllDeviceId($v['operation_id'], $title, $content, $type, $v['user_id'], $is_forbidden, $v['house_id'], $v['order_id'], $v['message']); $this->pushAgentAllDeviceId($v['operation_id'], $title, $content, $type, $v['user_id'], $is_forbidden, $v['house_id'], $v['order_id'], $v['message']);
......
...@@ -124,12 +124,17 @@ class RegisterService ...@@ -124,12 +124,17 @@ class RegisterService
$jwt_data['phone'] = $phone; $jwt_data['phone'] = $phone;
$coupon_service = new CouponService(); $coupon_service = new CouponService();
$service = new PushClientService();
if (!empty($first_login_time)) { if (!empty($first_login_time)) {
$coupon_service->sendCoupon((int)$id, 0, 0); $coupon_service->sendCoupon((int)$id, 0, 0, 1);
$content = '恭喜您您获得500元的新人专享返现红包,成交后可兑现';
$service->record(0,0,1, $content, 0, $id);
} }
if (!empty($registration_time) && $referrer_source == 10 && $referrer_id) { if (!empty($registration_time) && $referrer_source == 10 && $referrer_id) {
$coupon_service->sendCoupon((int)$referrer_id, $id, 2); $coupon_service->sendCoupon((int)$referrer_id, $id, 2);
$content = '恭喜您您获得500元的邀请成交返现红包,好友成交后可兑现';
$service->record(0,0,2,$content, 0, $referrer_id);
} }
$jwt = new JwtUntils(); $jwt = new JwtUntils();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment