Commit ae240936 authored by hujun's avatar hujun

推送

parent f13969a3
......@@ -32,10 +32,11 @@ class CouponService{
* @param int $user_id
* @param int $invitee_id
* @param int $type
* @param int $first_show
* @return mixed
* @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['msg'] = '发券成功';
$result['data'] = [];
......@@ -70,6 +71,7 @@ class CouponService{
$save_data['invitee_id'] = $invitee_id;
}
$save_data['status'] = 0;
$save_data['first_show'] = $first_show;
$save_data['create_time'] = date('Y-m-d H:i:s');
$this->m_coupon->startTrans();
$coupon_untils = new CouponNoEncodingUntils();
......
......@@ -33,7 +33,7 @@ class PushClientService
* @param int $operation_id
* @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();
......@@ -42,6 +42,10 @@ class PushClientService
$report = new OReportModel();
$user_id = $report->getFieldValue('user_id', ['id'=>$report_id]);
if (empty($user_id)) {
$user_id = $addressee_id;
}
if (empty($message)) {
$m_agent = new AAgents();
$message = $m_agent->getAgentsById($operation_id, 'name');
......@@ -70,6 +74,16 @@ class PushClientService
$type = 'evaluate';
$content = '同联商业邀请您评价经纪人'.$v['message'].'对商铺的带看服务';
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']);
......
......@@ -124,12 +124,17 @@ class RegisterService
$jwt_data['phone'] = $phone;
$coupon_service = new CouponService();
$service = new PushClientService();
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) {
$coupon_service->sendCoupon((int)$referrer_id, $id, 2);
$content = '恭喜您您获得500元的邀请成交返现红包,好友成交后可兑现';
$service->record(0,0,2,$content, 0, $referrer_id);
}
$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