|
@@ -21,9 +21,7 @@ class CouponRightService extends BaseService
|
|
|
//给用户增加发卷的权力 shish
|
|
//给用户增加发卷的权力 shish
|
|
|
public static function addRight($order)
|
|
public static function addRight($order)
|
|
|
{
|
|
{
|
|
|
- $categoryId = $order['categoryId'];
|
|
|
|
|
- $usageId = $order['usageId'];
|
|
|
|
|
- $userId = Yii::$app->params['userId'];
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//老带新详情和优惠卷详情 shish 2019.8.25
|
|
//老带新详情和优惠卷详情 shish 2019.8.25
|
|
@@ -42,12 +40,11 @@ class CouponRightService extends BaseService
|
|
|
//我的可以分享的优惠卷 shish
|
|
//我的可以分享的优惠卷 shish
|
|
|
public static function myShare()
|
|
public static function myShare()
|
|
|
{
|
|
{
|
|
|
- $userId = Yii::$app->params['userId'];
|
|
|
|
|
- $list = self::getAllByCondition(['userId' => $userId]);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//给予老带新优惠卷发放权 shish
|
|
//给予老带新优惠卷发放权 shish
|
|
|
- public static function grantRight($order)
|
|
|
|
|
|
|
+ public static function grantRight($order, $merchant)
|
|
|
{
|
|
{
|
|
|
$categoryId = $order['categoryId'];
|
|
$categoryId = $order['categoryId'];
|
|
|
$usageId = $order['usageId'];
|
|
$usageId = $order['usageId'];
|
|
@@ -82,13 +79,12 @@ class CouponRightService extends BaseService
|
|
|
|
|
|
|
|
//消息通知
|
|
//消息通知
|
|
|
$allTM = xhTMessageService::getList($merchantId);
|
|
$allTM = xhTMessageService::getList($merchantId);
|
|
|
- $merchant = Yii::$app->params['merchant'];
|
|
|
|
|
$user = UserService::getById($userId);
|
|
$user = UserService::getById($userId);
|
|
|
|
|
|
|
|
if ($user['subscribe'] == 1) {
|
|
if ($user['subscribe'] == 1) {
|
|
|
$shortTempId = 'OPENTM207422813';//收入提醒
|
|
$shortTempId = 'OPENTM207422813';//收入提醒
|
|
|
if (isset($allTM[$shortTempId])) {
|
|
if (isset($allTM[$shortTempId])) {
|
|
|
- $tempId = $allTM[$shortTempId];
|
|
|
|
|
|
|
+ $tempId = $allTM[$shortTempId];
|
|
|
$openId = $user['openId'];
|
|
$openId = $user['openId'];
|
|
|
$data = ["touser" => $openId, "template_id" => $tempId,
|
|
$data = ["touser" => $openId, "template_id" => $tempId,
|
|
|
"url" => Yii::$app->params['mobileUrl'] . '/center/my-right?account=' . $merchant['id'],
|
|
"url" => Yii::$app->params['mobileUrl'] . '/center/my-right?account=' . $merchant['id'],
|
|
@@ -104,7 +100,7 @@ class CouponRightService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//分享出去之后领取优惠卷 shish
|
|
//分享出去之后领取优惠卷 shish
|
|
|
- public static function gainCoupon($data)
|
|
|
|
|
|
|
+ public static function gainCoupon($data,$userId)
|
|
|
{
|
|
{
|
|
|
validate::easyCheck(['rightId'], $data);
|
|
validate::easyCheck(['rightId'], $data);
|
|
|
$rightId = $data['rightId'];
|
|
$rightId = $data['rightId'];
|
|
@@ -112,7 +108,6 @@ class CouponRightService extends BaseService
|
|
|
if (empty($right)) {
|
|
if (empty($right)) {
|
|
|
util::fail('没有找到优惠卷');
|
|
util::fail('没有找到优惠卷');
|
|
|
}
|
|
}
|
|
|
- $userId = Yii::$app->params['userId'];
|
|
|
|
|
if ($right['userId'] == $userId) {
|
|
if ($right['userId'] == $userId) {
|
|
|
util::fail('不能领自己发的卷');
|
|
util::fail('不能领自己发的卷');
|
|
|
}
|
|
}
|
|
@@ -172,7 +167,7 @@ class CouponRightService extends BaseService
|
|
|
$allTM = xhTMessageService::getList($merchantId);
|
|
$allTM = xhTMessageService::getList($merchantId);
|
|
|
$shortTempId = 'OPENTM207430125';
|
|
$shortTempId = 'OPENTM207430125';
|
|
|
if (isset($allTM[$shortTempId])) {
|
|
if (isset($allTM[$shortTempId])) {
|
|
|
- $tempId = $allTM[$shortTempId];
|
|
|
|
|
|
|
+ $tempId = $allTM[$shortTempId];
|
|
|
$url = Yii::$app->params['mobileUrl'] . '/center/my-coupon?account=' . $merchantId;
|
|
$url = Yii::$app->params['mobileUrl'] . '/center/my-coupon?account=' . $merchantId;
|
|
|
$data = [
|
|
$data = [
|
|
|
"touser" => $openId, "template_id" => $tempId, "url" => $url,
|
|
"touser" => $openId, "template_id" => $tempId, "url" => $url,
|
|
@@ -192,7 +187,7 @@ class CouponRightService extends BaseService
|
|
|
$allTM = xhTMessageService::getList($merchantId);
|
|
$allTM = xhTMessageService::getList($merchantId);
|
|
|
$shortTempId = 'OPENTM207430125';
|
|
$shortTempId = 'OPENTM207430125';
|
|
|
if (isset($allTM[$shortTempId])) {
|
|
if (isset($allTM[$shortTempId])) {
|
|
|
- $tempId = $allTM[$shortTempId];
|
|
|
|
|
|
|
+ $tempId = $allTM[$shortTempId];
|
|
|
$url = Yii::$app->params['mobileUrl'] . '/center/get-coupon?account=' . $merchantId;
|
|
$url = Yii::$app->params['mobileUrl'] . '/center/get-coupon?account=' . $merchantId;
|
|
|
$data = [
|
|
$data = [
|
|
|
"touser" => $openId, "template_id" => $tempId, "url" => $url,
|
|
"touser" => $openId, "template_id" => $tempId, "url" => $url,
|