作者 lishaoshuai
1 个管道 的构建 通过 耗费 0 秒

合并分支 'revert-4f554c12' 到 'master'

Revert 4f554c12



查看合并请求 !1
... ... @@ -39,6 +39,7 @@ class IndexController extends RestBaseController
'40011' => '该产品不存在',
'40012' => '您已被管理员拉黑',
'40013' => '余额不足2元',
'40014' => '不能申请自己的产品',
]
];
$this->success("恭喜您,API访问成功!", $data);
... ...
... ... @@ -149,16 +149,20 @@ class CardController extends RestBaseController
} else {
$result['is_like'] = 0;
}
//添加该名片的被浏览记录
//添加该名片的被浏览记录 名片入口
Db::startTrans();
$is_exist = Db::name('browse_log')
->where(['topic_id' => $data['id'],'user_id' => $this->userId])
->where(['topic_id' => $data['id'],'user_id' => $this->userId,'type' =>1])
->field('id')
->find();
if ($is_exist) {
$do1 = Db::name('browse_log')->where(['topic_id' => $data['id'],'user_id' => $this->userId])->update(['create_time' => date('Y-m-d H:i:s')]);
} else {
$do1 = Db::name('browse_log')->insert(['topic_id' => $data['id'],'user_id' => $this->userId]);
if (!$is_exist) {
//排除业务员自己
if ($this->userType == 3) {
$card_id = Db::name('card')->where(['user_id' => $this->userId])->value('id');
}
if (isset($card_id) && $card_id != $data['id']) {
$do1 = Db::name('browse_log')->insert(['topic_id' => $data['id'],'user_id' => $this->userId]);
}
}
//浏览数+1
$do2 = Db::name('card')->where(['id' => $data['id']])->setInc('browse_num');
... ...
... ... @@ -484,11 +484,6 @@ class ProductController extends RestBaseController
if ($check) {
$this->error(['code'=>'40006','msg'=>'该产品您已申请']);
}
//添加该名片的被浏览记录 产品 入口
$is_exist = Db::name('browse_log')
->where(['topic_id' => $data['id'],'user_id' => $this->userId])
->field('id')
->find();
$cardID = Db::name('product')
->alias('p')
->join('card c','p.user_id =c.user_id')
... ... @@ -497,6 +492,18 @@ class ProductController extends RestBaseController
if (!$cardID) {
$this->error(['code'=>'40011','msg'=>'该产品不存在']);
}
//排除业务员自己 不能申请自己产品
if ($this->userType == 3) {
$card_id = Db::name('card')->where(['user_id' => $this->userId])->value('id');
if ($cardID == $card_id) {
$this->error(['code'=>'40014','msg'=>'不能申请自己的产品']);
}
}
//添加该名片的被浏览记录 产品 入口
$is_exist = Db::name('browse_log')
->where(['topic_id' => $data['id'],'user_id' => $this->userId,'type' =>2])
->field('id')
->find();
if (!$is_exist) {
Db::name('browse_log')->insert(['topic_id' => $cardID,'user_id' => $this->userId,'type'=>2]);
}
... ...
... ... @@ -130,6 +130,7 @@ class UserController extends RestBaseController
->join('browse_log b','c.id = b.topic_id')
->field('b.user_id')
->where(['c.user_id' => $this->userId])
->group('b.user_id')
->buildSql();
$result = Db::table($subQuery)
->alias('a')
... ...