api_material_1124
This commit is contained in:
@@ -50,11 +50,16 @@ class Topic extends Wxapp
|
||||
//加店铺专题浏览
|
||||
$where_s = ['app_id' => $this->app_id, 'biz_id' => $biz_id, 't_id' => $id, 'day' => date('Y-m-d')];
|
||||
$re_s = $this->mdBizStatistics->get($where_s);
|
||||
$key = "material_biz_browse_num_{$this->myuid}_{$this->app_id}_{$biz_id}_{$id}";
|
||||
if ($re_s) {
|
||||
$this->mdBizStatistics->update(['browse_num = browse_num+1' => null], $where_s);
|
||||
if (!$this->app_redis->get($key)) {
|
||||
$this->mdBizStatistics->update(['browse_num = browse_num+1' => null], $where_s);
|
||||
$this->app_redis->save($key, 1, 24 * 3600);//有效期1天
|
||||
}
|
||||
} else {
|
||||
$where_s['browse_num'] = 1;
|
||||
$this->mdBizStatistics->add($where_s);
|
||||
$this->app_redis->save($key, 1, 24 * 3600);//有效期1天
|
||||
}
|
||||
}
|
||||
$lists = array();
|
||||
@@ -87,4 +92,76 @@ class Topic extends Wxapp
|
||||
$this->data['lists'] = $lists;
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:专题预约报名
|
||||
* Created on: 2021/11/23 17:16
|
||||
* Created by: dengbw
|
||||
* @throws Hd_exception
|
||||
*/
|
||||
protected function put()
|
||||
{
|
||||
$this->load->model('sys/sys_area_model');
|
||||
$this->load->model('receiver/receiver_clues_model', 'clues_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$recommend_id = intval($this->input_param('cf_uid')); //来源用户id 分销
|
||||
$biz_id = intval($this->input_param('biz_id'));
|
||||
$t_id = intval($this->input_param('t_id'));
|
||||
$city_id = $this->input_param('city_id');
|
||||
$lat = $this->input_param('lat');
|
||||
$lng = $this->input_param('lng');
|
||||
$cf_id = 1;
|
||||
$brand_id = 0;
|
||||
$recommend_id && $cf_id = 8;
|
||||
$city_id && $city_row = $this->sys_area_model->get(['county_id' => $city_id], 'id,county_id,city_id');
|
||||
$re_t = $this->mdTemplate->get(['id' => $t_id]);
|
||||
if ($re_t && $re_t['brand_ids']) {
|
||||
$brand_ids = implode(',', $re_t['brand_ids']);
|
||||
$brand_id = count($brand_ids) >= 2 ? $brand_ids[1] : $re_t['brand_ids'];
|
||||
}
|
||||
$row = $this->clues_model->get(['mobile' => $this->session['mobile']]);
|
||||
if ($row) {
|
||||
$update = ['en_time' => date('Y-m-d H:i:s')];
|
||||
$brand_id && $update['brand_id'] = $brand_id;
|
||||
$this->clues_model->update($update, ['id' => $row['id']]);
|
||||
//增加日志
|
||||
$uname = $this->session['nickname'] ? $this->session['nickname'] : '用户';
|
||||
$cf_title = $this->clues_entity->cf_title($cf_id);
|
||||
$log_msg = '用户报名';
|
||||
$cf_title && $log_msg = "用户通过【{$cf_title}】报名";
|
||||
$this->clues_entity->add_log($row['id'], $this->session['uid'], $uname, $log_msg);
|
||||
//throw new Exception('预约成功,不需要重复报名', API_CODE_FAIL);
|
||||
throw new Hd_exception('预约报名成功了!', API_CODE_SUCCESS);
|
||||
}
|
||||
$jsondata['info'] = ['biz_id' => $biz_id ? $biz_id : ''];
|
||||
$t_id && $jsondata['info']['t_id'] = $t_id;
|
||||
$add_data = [
|
||||
'name' => $this->session['nickname'],
|
||||
'mobile' => $this->session['mobile'],
|
||||
'cf_uid' => $this->session['uid'],
|
||||
'cf_id' => $cf_id,
|
||||
'app_id' => $this->app_id,
|
||||
'if_driver' => 1,
|
||||
'cf_platform' => 'wxapp',
|
||||
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
|
||||
'en_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => time()
|
||||
];
|
||||
$recommend_id && $add_data['recommend_id'] = $recommend_id;
|
||||
$brand_id && $add_data['brand_id'] = $brand_id;
|
||||
$city_row && $add_data['city_id'] = $city_row['city_id'];
|
||||
$city_row && $add_data['county_id'] = $city_row['county_id'];
|
||||
$lat && $add_data['lat'] = $lat;
|
||||
$lng && $add_data['lng'] = $lng;
|
||||
$id = $this->clues_model->add($add_data);
|
||||
if ($id) {
|
||||
$uname = $this->session['nickname'] ? $this->session['nickname'] : '用户';
|
||||
$cf_title = $this->clues_entity->cf_title($cf_id);
|
||||
$log_msg = '用户报名';
|
||||
$cf_title && $log_msg = "用户通过【{$cf_title}】报名";
|
||||
$this->clues_entity->add_log($id, $this->session['uid'], $uname, $log_msg);
|
||||
}
|
||||
throw new Hd_exception('预约报名成功!', API_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user