修改自加函数

This commit is contained in:
邹景立 2021-03-22 14:44:37 +08:00
parent 5d2e753bcb
commit 505100c3ae
2 changed files with 5 additions and 8 deletions

View File

@ -40,11 +40,10 @@ class Goods extends Controller
*/
public function getGoods()
{
if ($code = input('code', '')) {
$this->app->db->name('ShopGoods')->where(['code' => $code])->update([
'num_read' => $this->app->db->raw('num_read+1'),
]);
}
// 更新访问统计
$map = $this->_vali(['code.default' => '']);
if ($map['code']) $this->app->db->name('ShopGoods')->where($map)->inc('num_read')->update();
// 商品数据处理
$query = $this->_query('ShopGoods')->like('name,marks,cateids,payment')->equal('code,vip_entry');
$result = $query->where(['deleted' => 0, 'status' => 1])->order('sort desc,id desc')->page(true, false, false, 10);
if (count($result['list']) > 0) GoodsService::instance()->bindData($result['list']);

View File

@ -34,9 +34,7 @@ class News extends Controller
public function getItem()
{
if ($code = input('code', '')) {
$this->app->db->name('DataNewsItem')->where(['code' => $code])->update([
'num_read' => $this->app->db->raw('`num_read`+1'),
]);
$this->app->db->name('DataNewsItem')->where(['code' => $code])->inc('num_read')->update();
if (($uid = input('uid', 0)) > 0) {
$data = ['uid' => $uid, 'code' => $code, 'type' => 3, 'status' => 2];
$this->app->db->name('DataNewsXCollect')->where($data)->delete();