add-api-distribution

This commit is contained in:
lccsw
2021-08-03 14:18:13 +08:00
parent 5d8371d41f
commit 8e1d8059f2
27 changed files with 1031 additions and 176 deletions
+5 -7
View File
@@ -10,16 +10,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Cms extends HD_Controller
{
private $log_dir;
static $pos_arr = array(
'首页bannber','热门活动','购车banner'
);
private $pos_arr;
public function __construct()
{
parent::__construct();
$this->load->model('app/liche/App_liche_cms_model', 'liche_cms_model');
$this->load->model('app/App_model', 'appM');
$this->pos_arr = $this->liche_cms_model->get_position(true);
}
public function index()
@@ -47,10 +45,10 @@ class Cms extends HD_Controller
foreach ($lists as $key => $value) {
$lists[$key]['s_time'] = date('Y-m-d H:i:s', $value['s_time']);
$lists[$key]['e_time'] = date('Y-m-d H:i:s', $value['e_time']);
$lists[$key]['position'] = self::$pos_arr[$value['position']];
$lists[$key]['position'] = $this->pos_arr[$value['position']];
}
$count = $this->liche_cms_model->count($where);
$this->data['pos_arr'] = self::$pos_arr;
$this->data['pos_arr'] = $this->pos_arr;
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count, 'total' => $count);
$this->data['_title'] = $this->title . '列表';
@@ -85,7 +83,7 @@ class Cms extends HD_Controller
//列表
$this->data['app_id'] = 3;
$this->data['info'] = $row;
$this->data['pos_arr'] = self::$pos_arr;
$this->data['pos_arr'] = $this->pos_arr;
$this->data['covers'] = $covers;
$this->data['url'] = $opration;
$this->data['_title'] = $title;
+4 -25
View File
@@ -110,33 +110,12 @@ class Member extends HD_Controller{
public function edit()
{
$id = $this->input->post('id');
$nickname = $this->input->post('nickname');
$mobile = $this->input->post('mobile');
$headimg = $this->input->post('logo');
$ifdist = $this->input->post('ifdist');
if (!$mobile) {
return $this->show_json(SYS_CODE_FAIL, '输入手机号');
}
if (!$nickname) {
return $this->show_json(SYS_CODE_FAIL, '输入昵称');
}
$old = $this->userM->get(array('id' => $id));
if (4 != $old['group_id']) {
return $this->show_json(SYS_CODE_FAIL, '只支持编辑马甲');
}
$exist = $this->userM->get(array('mobile' => $mobile, 'id <>' => $id));
if ($exist) {
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
}
$upd = array(
'mobile' => $mobile,
'nickname' => $nickname,
'headimg' => $headimg ? $headimg : '',
);
$upd = [
'ifdist' => $ifdist,
];
$this->userM->update($upd, array('id' => $id));
+6
View File
@@ -43,6 +43,12 @@
</select>
</div>
</div>
<div class="am-form-group" v-if="info.position >2 && info.position<8">
<label class="am-para-label">链接类型:</label>
<div class="am-para-input pt5">
<input type="radio" name="type" v-model="info.type" value="1"/>小程序
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">链接:</label>
<div class="am-para-input wp60">
+2
View File
@@ -57,6 +57,7 @@
<th width="8%"><span>ID</span></th>
<th width="20%"><span>标题</span></th>
<th width="20%"><span>位置</span></th>
<th width="5%"><span>排序值</span></th>
<th width="20%"><span>开始时间</span></th>
<th width="20%"><span>结束时间</span></th>
<th width="15%"><span>状态</span></th>
@@ -70,6 +71,7 @@
<td>{{value.id}}</td>
<td>{{value.title}}</td>
<td>{{value.position}}</td>
<td>{{value.sort}}</td>
<td>{{value.s_time}}</td>
<td>{{value.e_time}}</td>
<td v-if="value.status == '0'">下架</td>
+22 -10
View File
@@ -26,6 +26,7 @@
<th width="10%"><span>ID</span></th>
<th width="20%"><span>用户名称</span></th>
<th width="20%"><span>手机号码</span></th>
<th width="5%"><span>是否分销</span></th>
<th width="20%"><span>创建时间</span></th>
</tr>
</thead>
@@ -35,6 +36,9 @@
<td><?= $v['id'] ?></td>
<td><?= $v['nickname'] ?></td>
<td><?= $v['mobile'] ?></td>
<td>
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" <?=$v['ifdist']?'checked':''?> onchange="set_publish(this,<?=$v['id']?>)"/>
</td>
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></td>
</tr>
<!--
@@ -55,14 +59,22 @@
</div>
</div>
<script>
$('#bd-hd-city').change(function () {
var city = $(this).find('option:selected').text();
});
$('#majia').change(function () {
$('#vue-app').submit();
});
$('#dealer').change(function () {
$('#vue-app').submit();
});
function set_publish(obj,id){
var value = '';
if($(obj).get(0).checked) {
value = 1;
}else{
value = 0;
}
var data = {'id':id,'ifdist':value};
$.post('/app/liche/member/edit',data,function(result){
if(result.code){
layer.msg(result.msg, {time: 2000,icon:1 }, function () {
$.form.reload();
});
}else{
layer.msg(result.msg,{icon:2});
}
},'json')
}
</script>
+1
View File
@@ -23,6 +23,7 @@ class Config extends Wxapp{
$publish = $this->app_config('publish');
$data = array(
'publish' => intval($publish),
'service_phone' => '1812334344',
);
return $data;
}
@@ -94,4 +94,19 @@ class Sub_cms extends Wxapp{
);
return $data;
}
//获取cms tab
protected function get_tabs(){
$posion_arr = $this->cms_model->get_position();
$data = [];
foreach($posion_arr as $key => $val){
if($key>2 && $key<8){
$data[] = [
'id' => $key,
'name' => $val
];
}
}
return $data;
}
}
+107
View File
@@ -0,0 +1,107 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Created by Vim
* User: lcc
* Date: 2021/07/30
* Time: 14:08
*/
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Account extends Wxapp{
function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
$this->load->model('app/user_account_model','account_model');
$this->load->model('app/user_accountlog_model','accountlog_model');
}
protected function get(){
$uid = $this->session['uid'];
$this->load->library('entity/account_entity');
$account_entity = new Account_entity($this->app_id);
$account = $account_entity->get_account($uid,'user');
$left_money = $account['money_left'] ? $account['money_left'] : 0;
$where = [
'trade_type' => 2,
'account_id' => $account['id']
];
$withdraw = $this->accountlog_model->sum('money_out',$where);
$data = [
'left_money' => number_format($left_money,2),
'withdraw_money' => number_format($withdraw['money_out'],2)
];
return $data;
}
//金额日志
protected function get_logs(){
$uid = $this->session['uid'];
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 20;
$user = $this->account_model->get(['app_id'=>$this->app_id,'app_uid'=>$uid,'type'=>1]);
$count = 0;
$list = [];
if($user){
$where = [
'account_id' => $user['id']
];
$count = $this->accountlog_model->count($where);
$rows = $this->accountlog_model->select($where,'id desc',$page,$size,'id,money_type,descrip,money_in,money_out,c_time');
foreach($rows as $key=>$val){
if($val['money_in']>0){
$money = "+".number_format($val['money_in'],2).'元';
}else{
$money = "-".number_format($val['money_out'],2).'元';
}
$list[] = [
'money' => $money,
'money_type' => $val['money_in']>0 ? 1 : 0,
'descrip' => $val['descrip'],
'time' => date('Y.n.d',$val['c_time'])
];
}
}
$data = [
'list' => $list,
'total' => $count
];
return $data;
}
//提现
protected function post(){
$uid = $this->session['uid'];
$user = $this->app_user_model->get(array('id' => $uid));
$jsondata = json_decode($user['jsondata'],true);
if(!$jsondata['alipay']){
throw new Exception('用户未设置支付宝信息', API_CODE_FAIL);
}
$money = $this->input_param('money');
if(!$money){
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
}
$this->load->library('entity/account_entity');
$params['jsondata'] = $jsondata['alipay'];
$account_entity = new Account_entity($this->app_id,$params);
$account = $account_entity->get_account($uid,'user');
if($money>$account['money_left']){
throw new Exception('可提现金额不足', API_CODE_FAIL);
}
$sql_arr = $account_entity->cash($account['id'],$money);
$this->load->helper('db');
$ret = trans_sql($sql_arr);
if($ret){
throw new Exception('申请提现成功', API_CODE_SUCCESS);
}else{
throw new Exception('申请提现失败', API_CODE_FAIL);
}
}
}
+4
View File
@@ -115,6 +115,8 @@ class Aptinfo extends Wxapp{
$biz_id = $this->input_param('biz_id');
$series_id = $this->input_param('car_id');//车系id
$city_code = $this->input_param('city_id');
$recommend_id = intval($this->input_param('cf_uid')); //来源用户id
$series_row = $this->auto_series_model->get(['id'=>$series_id]);
if($this->clues_model->count(['cf_id'=>$cf_id,'cf_uid'=>$uid,'app_id'=>$this->app_id,'status'=>0])){
throw new Exception('您已预约', API_CODE_SUCCESS);
@@ -136,6 +138,8 @@ class Aptinfo extends Wxapp{
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
'c_time' => time()
];
$recommend_id && $add_data['recommend_id'] = $recommend_id;
$series_row['brand_id'] && $add_data['brand_id'] = $series_row['brand_id'];
$series_row['id'] && $add_data['s_id'] = $series_row['id'];
$this->clues_model->add($add_data);
+2 -1
View File
@@ -77,6 +77,7 @@ class Car extends Wxapp{
$s_id = $this->input_param('id'); //车系id
$c_id = intval($this->input_param('c_id')); //颜色属性id
$v_id = intval($this->input_param('v_id')); //车型属性id
$recommend_id = intval($this->input_param('cf_uid')); //来源用户id
if($this->clues_model->count(['cf_id'=>$cf_id,'cf_uid'=>$uid,'status'=>0])){
throw new Exception('您已订购', API_CODE_INVILD_PARAM);
@@ -116,11 +117,11 @@ class Car extends Wxapp{
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
'c_time' => time()
];
$recommend_id && $add_data['recommend_id'] = $recommend_id;
$id = $this->clues_model->add($add_data);
if(!$id){
throw new Exception('提交失败', API_CODE_INVILD_PARAM);
}
$order_id = '';
$price = 5000;
$sid = create_order_no(350200, $this->app_key);
if($color['jsondata']['img']){
+174
View File
@@ -0,0 +1,174 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Created by Vim
* User: lcc
* Date: 2021/07/29
* Time: 14:08
*/
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Statistics extends Wxapp{
function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
$this->load->model('receiver/receiver_clue_statistics_model','statistics_model');
$this->load->model('receiver/receiver_clues_model','clues_model');
}
protected function get(){
}
//累计数据
protected function get_cal(){
$uid = $this->session['uid'];
$brower = $this->statistics_model->sum('browse_num',['app_id'=>$this->app_id,'uid'=>$uid]);
$clues = $this->clues_model->count(['app_id'=>$this->app_id,'recommend_id'=>$uid]);
$where = [
'lc_receiver_clues.recommend_id' => $uid,
'lc_receiver_orders.status' => 6
];
$done = $this->clues_model->count_order($where);
$data = [
['name'=>'浏览','value'=>intval($brower['browse_num'])],
['name'=>'报名','value'=>$clues],
['name'=>'成交','value'=>$done]
];
return $data;
}
//根据车型获取统计
protected function get_car(){
$this->load->model('auto/auto_series_model');
$uid = $this->session['uid'];
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 20;
$t1 = 'lc_auto_series';
$t2 = 'lc_auto_brand';
$fileds = "$t1.id,$t1.name,$t2.name as brand_name";
$where = [];
$count = $this->auto_series_model->select_brand($where,'',$page,$size,$fileds,1);
$rows = $this->auto_series_model->select_brand($where,'',$page,$size,$fileds);
$list = [];
if($rows){
foreach($rows as $key => $val){
$enroll = $this->clues_model->count(['app_id'=>$this->app_id,'recommend_id'=>$uid,'s_id'=>$val['id']]);
$where = [
'lc_receiver_clues.recommend_id' => $uid,
'lc_receiver_clues.s_id' => $val['id'],
'lc_receiver_orders.status' => 6
];
$done = $this->clues_model->count_order($where);
$commision = 0;
$list[] = [
'title' => $val['brand_name'].$val['name'],
'enroll' => $enroll,
'done' => $done,
'commision' => number_format($done*500,2)
];
}
}
$data = [
'list' => $list,
'total' => $count
];
return $data;
}
//表格统计数据
protected function get_chart(){
$uid = $this->session['uid'];
$type = $this->input_param('type');
$before = 7;
$type && $before = 30;
$show_date = $date = [];
for ($i=1; $i<=$before; $i++){
$show_date[] = date('n.d' ,strtotime( '+' . $i-$before .' days', time()));
$date[] = date('Y-m-d' ,strtotime( '+' . $i-$before .' days', time()));
}
//根据时间统计
$enroll_data = $l_data = [];
foreach($date as $kye=>$val){
$enroll = $this->statistics_model->get(['app_id'=>$this->app_id,'uid'=>$uid,'day'=>$val]);
$l_data[] = $enroll ? $enroll['browse_num'] : 0;
$s_time = strtotime($val.' 00:00:00');
$e_time = strtotime($val.' 23:59:59');
$enroll_data[] = $this->clues_model->count(['app_id'=>$this->app_id,'recommend_id'=>$uid,'c_time>'=>$s_time,'c_time<='=>$e_time]);
}
$data = [
'legend' => [
'data' => ['浏览','报名'],
'bottom' => 20,
'left' => 'center',
'z' => 100
],
'grid' => ['containLabel' => true],
'tooltip' => ['show' => true,'trigger' => 'axis'],
'xAxis' => [
'type' => 'category',
'boundaryGap' => false,
'data' => $show_date,
'show' => true
],
'yAxis' => [
'x' => 'center',
'type' => 'value',
'splitLine' => [
'lineStyle' => ['type'=>'dashed']
],
'show' => true
],
'series' => [
[
'name'=>'浏览',
'type'=>'line',
'smooth'=>true,
'data' => $l_data,
],
[
'name'=>'报名',
'type'=>'line',
'smooth'=>true,
'data' => $enroll_data,
]
]
];
return $data;
}
//增加浏览
protected function post(){
$cf_uid = $this->input_param('cf_uid');
if(!$cf_uid){
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
}
$where = [
'app_id' => $this->app_id,
'uid' => $cf_uid,
'day' => date('Y-m-d')
];
$row = $this->statistics_model->get($where);
if($row){
$res = $this->statistics_model->update(['browse_num = browse_num+1 ' => null],['id'=>$row['id']]);
}else{
$add_data = [
'app_id' => $this->app_id,
'uid' => $cf_uid,
'browse_num' => 1,
'day' => date('Y-m-d'),
'c_time' => time()
];
$res = $this->statistics_model->add($add_data);
}
if($res){
throw new Exception('保存成功', API_CODE_SUCCESS);
}else{
throw new Exception('保存失败', API_CODE_FAIL);
}
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* Created by Vim
* User: lcc
* Date: 2021/06/23
* Time: 14:08
*/
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Udata extends Wxapp{
function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
$this->load->model('app/liche/app_liche_cms_model', 'cms_model');
$this->load->model('app/liche/app_liche_udata_model', 'udata_model');
}
protected function get_fcms(){
$uid = $this->session['uid'];
$id = $this->input_param('id');//cms id
$cms = $this->cms_model->get(['id'=>$id]);
if(!$cms){
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
}
$udata = $this->udata_model->get(['cf_id'=>$id,'type'=>0,'datatype'=>'img']);
if(!$udata){
$url_arr = parse_url($cms['url']);
$arr_query = convert_url_query($url_arr['query']);
$page = $url_arr['path'];
$this->config->load('app', true);
$appconfig = $this->config->item('liche', 'app');
$wxconfig = $appconfig['wx'];
$width = '160px';
$scene = "{$uid}_distribute";
$arr_query['id'] && $scene = "{$arr_query['id']}_".$scene;
$filename = 'wx_'.substr(md5($path.$uid.time()), 8, 16);
$this->load->library('hdwechat', $wxconfig);
$result = $this->hdwechat->qrcode($filename, $scene, $page, $width);
if(!$result){
throw new Exception('创建二维码失败', API_CODE_FAIL);
}
$jsondata = [
'page' => $page,
'scene' => $scene
];
$add_data = [
'cf_id' => $id,
'type' => 0,
'datatype' => 'img',
'dataurl' => $result['file'],
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
'c_time' => time()
];
$this->udata_model->add($add_data);
$img = $result['url'];
}else{
$img = build_qiniu_image_url($udata['dataurl']);
}
return ['img'=>$img];
}
}
+27 -4
View File
@@ -80,12 +80,17 @@ class User extends Wxapp{
$uid = $this->session['uid'];
$user = $this->app_user_model->get(array('id' => $uid));
$jsondata = json_decode($user['jsondata'],true);
$data = array(
'uid' => $uid,
'mobile' => $user['mobile'],
'nickname' => $user['nickname'],
'headimg' => $user['headimg'],
'alipay' => [
'name' => $jsondata['alipay']['name'] ? $jsondata['alipay']['name'] : '',
'account' => $jsondata['alipay']['account'] ? $jsondata['alipay']['account'] : '',
],
);
return $data;
@@ -327,13 +332,15 @@ class User extends Wxapp{
];
}
}
$about = [
['title'=>'我的爱车','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-1.png','url'=>'/pages/mine/myCar/index'],
['title'=>'联系小狸','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-3.png'],
];
$this->session['ifdist'] && $about[] = ['title'=>'推广提现','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-4.png','url'=>'/pages/distribute/index'];
$data = [
'progressOpt' => $progressOpt,
'progress' => $progress,
'about' => [
['title'=>'我的爱车','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-1.png','url'=>'/pages/mine/myCar/index'],
['title'=>'联系小狸','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-3.png']
],
'about' => $about,
'order' => [
['title' => '全部订单', 'icon' => 'https://qs.haodian.cn/wechat_app/liche/mine/order-icon-1.png', 'url' => '/pages/order/index?typeId=0'],
['title' => '待付款', 'icon' => 'https://qs.haodian.cn/wechat_app/liche/mine/order-icon-2.png', 'url' => "/pages/order/index?typeId=1"],
@@ -430,4 +437,20 @@ class User extends Wxapp{
];
return $data;
}
//修改支付宝信息
protected function put_alipay(){
$uid = $this->session['uid'];
$account = $this->input_param('account');
$name = $this->input_param('name');
if(!$account || !$name){
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
}
$user = $this->app_user_model->get(array('id' => $uid));
$jsondata = json_decode($user['jsondata'],true);
$jsondata['alipay']['name'] = $name;
$jsondata['alipay']['account'] = $account;
$this->app_user_model->update(['jsondata'=>json_encode($jsondata,JSON_UNESCAPED_UNICODE)],['id'=>$uid]);
throw new Exception('保存成功', API_CODE_SUCCESS);
}
}
+4 -22
View File
@@ -82,22 +82,8 @@ class Hdwechat
*/
function qrcode($filename, $scene, $page, $width)
{
$file = APPPATH . '../www/api/wx/' . $filename . '.png';
$dir = substr($file, 0, strrpos($file, '/'));
if (!is_dir($dir)) {
$ret = mkdir($dir, 0777, true);// 如果文件夹不存在,将以递归方式创建该文件夹
if (!$ret) {
debug_log("[error] " . __FUNCTION__ . ": mkdir {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
return array();
}
}
if (file_exists($file)) {
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
}
$access_token = $this->access_token();
var_dump($access_token);exit;
if (!$access_token) {
debug_log("[error] " . __FUNCTION__ . ": not access_token", $this->log_file);
return array();
@@ -123,14 +109,10 @@ class Hdwechat
debug_log("[error] " . __FUNCTION__ . ": httpcode:{$code}, response:{$res}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
return array();
}
$ret = file_put_contents($file, $res);
if (false === $ret) {
debug_log("[error] " . __FUNCTION__ . ": file_put_contents {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
return array();
}
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
$CI = &get_instance();
$CI->load->library('qiniu');
$ret= $CI->qiniu->save("{$filename}.png", $res);
return $ret;
}
/**
+16 -43
View File
@@ -770,49 +770,6 @@ if (!function_exists('status_verify')) {
} else return false;
}
}
/**
* 计算贷款
*
* @param int $dkm 贷款期数
* @param int $dkTotal 贷款总额
* @param int $dknl 贷款年利率
* @param int $type 计算方式(0等额本金,1等额本息)
* @return array
*/
if (!function_exists('cal_loan')) {
function cal_loan($dkm, $dkTotal, $dknl, $type = 0)
{
if (!$dkm || !$dkTotal || !$dknl) {
return false;
}
$result = array();
if ($type) { //等额本金
$em = $dkTotal / $dkm; //每个月还款本金
for ($i = 0; $i < $dkm; $i++) {
$temp = array();
$lx = $dkTotal * $dknl / 12; //每月还款利息
$dkTotal -= $em;
$temp['lx'] = $lx;
$temp['em'] = $em;
$temp['total'] = $em + $lx;
$result[] = $temp;
}
} else { //等额本息
$emTotal = $dkTotal * $dknl / 12 * pow(1 + $dknl / 12, $dkm) / (pow(1 + $dknl / 12, $dkm) - 1); //每月还款金额
for ($i = 0; $i < $dkm; $i++) {
$temp = array();
$lx = $dkTotal * $dknl / 12; //每月还款利息
$em = $emTotal - $lx; //每月还款本金
$dkTotal = $dkTotal - $em;
$temp['lx'] = $lx;
$temp['em'] = $em;
$temp['total'] = $emTotal;
$result[] = $temp;
}
}
return $result;
}
}
/**
* Notes:商品图片
@@ -1066,3 +1023,19 @@ if(!function_exists('formart_bank_number')){
return implode(' ', $match);
}
}
if(!function_exists('convert_url_query')){
/**
* 将字符串参数变为数组
* @param $query
* @return array array()
*/
function convert_url_query($query){
$queryParts = explode('&', $query);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return $params;
}
}
+297
View File
@@ -0,0 +1,297 @@
<?php
class Account_entity{
const TYPE_USER = 'user';
const TYPE_BIZ = 'biz';
const AC_TYPE_USER = 1;
const AC_TYPE_BIZ = 2;
const MONEY_FLOW_IN = 'in'; //资金流入
const MONEY_FLOW_OUT = 'out'; //资金流出
const TRADE_TYPE_CONSUME = 1; //入账
const TRADE_TYPE_CASH = 2; //提现
const TRADE_TYPE_CHARGE = 3; //冲正
const TRADE_TYPE_TRANSFER = 4; //转账
private $appid;
private $ci;
/**
* 记账户流水暂存的余额
* @var array
*/
private $arr_tr_mleft = array();
public function __construct($appid,$params=[]){
$this->ci = & get_instance();
$this->ci->load->model('app/user_account_model','account_model');
$this->ci->load->model('app/user_accountlog_model','accountlog_model');
$this->account_model = $this->ci->account_model;
$this->accountlog_model = $this->ci->accountlog_model;
$this->app_id = $appid;
$params['order_id'] && $this->order_id = $params['order_id'];
$params['jsondata'] && $this->jsondata = $params['jsondata'];
$params['ck'] && $this->ck = $params['ck'];
}
/**
* 充值
* @param $account_id (账户ID)
* @param $money (金额)
* @param string $descrip (描述)
* @param array $svr (account_id, rate)
* @return array (sql数组)
*/
public function charge($account_id, $money, $descrip = ''){
$trade_type = self::TRADE_TYPE_CONSUME;
!$descrip && $descrip = '入账';
$ids = array($account_id);
//日志余额
$mleft = $this->get_logmleft($ids);
/*交易开始*/
$this->trade_start();
$this->arr_tr_mleft = $mleft;
$this->arr_tr_param = array('trade_type' => $trade_type, 'descrip' => $descrip);
//入账
$this->tr_money($account_id, $money, self::MONEY_FLOW_IN);
$ret = $this->trade_complete();
/*交易结束*/
return $ret;
}
/**
* 提现
* @param $account_id
* @param $money
* @param string $descrip
*/
public function cash($account_id, $money, $descrip = '提现'){
$trade_type = self::TRADE_TYPE_CASH;
//日志余额
$mleft = $this->get_logmleft([$account_id]);
/*交易开始*/
$this->trade_start();
$this->arr_tr_mleft = $mleft;
$this->arr_tr_param = array('trade_type' => $trade_type, 'descrip' => $descrip);
//入账
$this->tr_money($account_id, $money, self::MONEY_FLOW_OUT);
$ret = $this->trade_complete();
/*交易结束*/
return $ret;
}
/**
* 获取存交易流水的余额
* @param $account_ids
* @return array
*/
public function get_logmleft($account_ids){
$mleft = array();
foreach($account_ids as $v){
$log = $this->get_accountlog('last', $v);
$money_left = floatval($log['money_left']);
if($money_left <= 0){
$account = $this->get_account($v);
$money_left = floatval($account['money_left']);
}
$mleft[$v] = $money_left;
}
return $mleft;
}
/**
* 获取一条账户日志
* @param string $type 类型(last 最后一条)
* @param $account_id
* @param $logid
* @return mixed
*/
public function get_accountlog($type = 'last', $account_id = 0, $logid = 0){
$where = array();
$account_id && $where['account_id'] = $account_id;
$logid && $where['id'] = $logid;
switch($type){
default:
$order = 'id DESC';
}
$list = $this->accountlog_model->select($where, $order, 1, 1);
return $list ? $list[0] : array();
}
/**
* 获取账户
* @param $id (根据type组合)
* @param $type (user|biz|sys)
* @return mixed
*/
public function get_account($id, $type = ''){
$where = array('app_id' => $this->app_id);
switch($type){
case 'user':
$where['type'] = self::AC_TYPE_USER;
$where['app_uid'] = $id;
break;
case 'biz':
$where['type'] = self::AC_TYPE_BIZ;
$where['biz_id'] = $id;
break;
default:
$where['id'] = $id;
}
$account = $this->account_model->get($where);
return $account;
}
/**
*
* 开户
* @param $id (根据type 可以是uid、biz_id)
* @param string $type (user|biz)
* @return int
*/
public function new_account($id, $type = ''){
$data = array('app_id' => $this->app_id, 'c_time' => time());
switch($type){
case self::TYPE_USER:
$data['type'] = self::AC_TYPE_USER;
$data['app_uid'] = $id;
break;
case self::TYPE_BIZ:
$data['type'] = self::AC_TYPE_BIZ;
$data['biz_id'] = $id;
break;
default:
return 0;
}
$id = $this->account_model->add($data);
return $id;
}
/**
* 交易开始
*/
public function trade_start(){
$this->is_tr = true;
$this->arr_tr_mleft = array();
$this->arr_tr_param = array();
$this->sql_array = array();
//生成交易ID
$this->sid = date('Ymd') . time() . str_pad(rand(0, 999), 3, '0', STR_PAD_LEFT);
}
/**
* 交易完成
* @return array
*/
public function trade_complete(){
$sql_arr = $this->sql_array;
$status = true;
$msg = '';
if(!$this->is_tr){
$status = false;
$msg = '交易未初始化';
goto end;
}
if(!$sql_arr){
$status = false;
$msg = '无交易数据';
goto end;
}
end:
//设置交易结束
$this->is_tr = false;
$this->arr_tr_mleft = array();
$this->arr_tr_param = array();
$this->sql_array = array();
if(!$status){
$sql_arr = array();
}
return $sql_arr;
}
/**
* 交易金额
* @param $account_id
* @param $money (金额)
* @param $type (资金类型)
*/
protected function tr_money($account_id, $money, $type = 'in'){
$money = floatval($money);
if('out' == $type){
$logmoney = -$money;
$sql = "UPDATE `lc_app_user_account` SET money_left = money_left-{$money} WHERE id = {$account_id} AND money_left >= {$money}";
} else {
$logmoney = $money;
$sql = "UPDATE `lc_app_user_account` SET money_total=money_total+{$money}, money_left = money_left+{$money} WHERE id = {$account_id}";
}
$this->sql_array[] = $sql;
$this->tr_accountlog($account_id, $logmoney);
}
/**
* 记录money log
* @param $account_id (账户ID
* @param $money (金额,负数表示出账)
*/
private function tr_accountlog($account_id, $money){
$descrip = $this->arr_tr_param['descrip'];
$trade_type = $this->arr_tr_param['trade_type'];
$money_left = $this->arr_tr_mleft[$account_id];
$money_left += $money;//计算这次日志余额
$this->arr_tr_mleft[$account_id] = $money_left;
$c_time = $this->arr_tr_param['c_time'];
!$c_time && $c_time = time();
$data = array(
'account_id' => $this->ci->db->escape($account_id),
'trade_type' => $trade_type,
'money_type' => 0,
'money_in' => $money>0?$this->ci->db->escape($money):0,
'money_out' => $money<0?$this->ci->db->escape(abs($money)):0,
'money_left' => $money_left,
'descrip' => $this->ci->db->escape($descrip),
'c_time' => $this->ci->db->escape($c_time),
);
$this->ck && $data['ck'] = $this->ci->db->escape($this->ck);
$this->order_id && $data['sid'] = $this->order_id;
if($this->jsondata && is_array($this->jsondata)){
$data['jsondata'] = "'".json_encode($this->jsondata,JSON_UNESCAPED_UNICODE)."'";
}
$str_key = '`' . implode('`,`', array_keys($data)) .'`';
$str_val = "" . implode(",", array_values($data));
$this->sql_array[] = "INSERT INTO `lc_app_user_accountlog` ({$str_key}) VALUES ($str_val)";
}
}
@@ -208,12 +208,14 @@ class Orders_entity{
public function finish_after($oid,$app_id){
$this->ci->load->model('receiver/order/receiver_orders_model','orders_model');
$this->ci->load->model('receiver/receiver_customers_model','customers_model');
$this->ci->load->model('receiver/receiver_clues_model','clues_model');
$this->ci->load->model('apporder/order_purchase_model');
$row = $this->ci->orders_model->get(['id'=>$oid]);
if(!$row){
return false;
}
$customers = $this->ci->customers_model->get(['id'=>$row['rid']],'rid');
$clues = $this->ci->clues_model->get(['id'=>$customers['rid']],'mobile,recommend_id');
$res = false;
//获取线索生成的支付订单
$clu_order = $this->ci->order_purchase_model->get(['type'=>3,'status'=>2,'cf_id'=>$customers['rid'],'app_id'=>$app_id]);
@@ -225,6 +227,21 @@ class Orders_entity{
if($o_order){
$res = $this->ci->order_purchase_model->update(['status'=>3],['id'=>$o_order['id']]);
}
if($clues['recommend_id']){ //推荐人获得佣金
$this->ci->load->library('entity/account_entity');
$account_entity = new Account_entity($app_id,['order_id'=>$row['sid']]);
$account = $account_entity->get_account($clues['recommend_id'],'user');
if(!$account){
$a_id = $account_entity->new_account($clues['recommend_id'],'user');
}else{
$a_id = $account['id'];
}
$money=500;
$log_msg = $clues['mobile'].'成交';
$sql_arr = $account_entity->charge($a_id,$money,$log_msg);
$this->ci->load->helper('db');
$ret = trans_sql($sql_arr);
}
return $res;
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User_account_model extends HD_Model
{
private $table_name = 'lc_app_user_account';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User_accountlog_model extends HD_Model
{
private $table_name = 'lc_app_user_accountlog';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -9,8 +9,29 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class App_liche_cms_model extends HD_Model{
private $table_name = 'lc_app_liche_cms';
private $posion_arr = [
'首页bannber','热门活动','购车banner','活动专题','狸车海报','公号测评','朋友圈','其它'
];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
//获取cms位置
public function get_position($admin=false){
if($admin){
$data = [];
foreach($this->posion_arr as $key => $val){
if($key>2 && $key<=7){
$data[] = '推广素材-'.$val;
}else{
$data[] = $val;
}
}
}else{
$data = $this->posion_arr;
}
return $data;
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Vim.
* User: lcc
* Date: 2021/07/29
* Time: 16:24
*/
class App_liche_udata_model extends HD_Model{
private $table_name = 'lc_app_liche_udata';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -0,0 +1,21 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/07/30
* Time: 13:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_clue_statistics_model extends HD_Model
{
private $table_name = 'lc_receiver_clue_statistics';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
}
@@ -19,6 +19,38 @@ class Receiver_clues_model extends HD_Model
parent::__construct($this->table_name, 'default');
}
//关联订单
public function count_order($where){
return $this->select_order($where,'','','','',1);
}
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
!$fileds && $fileds = 'lc_receiver_clues.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_clues');
$this->db->join('lc_receiver_customers', 'lc_receiver_customers.rid = lc_receiver_clues.id','left');
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.rid = lc_receiver_customers.id','left');
if ($where) {
$this->db->where($where);
}
if ($count) {
return $this->db->count_all_results();
}
if ($order) {
$this->db->order_by($order);
}
if ($page) {
$offset = ($page - 1) * $page_size;
$limit = $page_size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
public function get_status(){
return $this->status_arr;
}
+47
View File
@@ -50,3 +50,50 @@ create table lc_app_wxpaylog (
u_time timestamp not null default current_timestamp comment '更新时间',
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='支付回调日志';
-- ----------------------------
-- Title:用户资金账户表
-- Author:lcc
-- Table:lc_app_user_account
-- ---------------------------
drop table if exists lc_app_user_account;
create table lc_app_user_account (
id int(10) unsigned not null auto_increment comment 'id',
app_id int(10) unsigned not null comment '小程序id',
app_uid int(10) unsigned not null comment '小程序用户id',
biz_id int(11) not null default '0' comment '商家id',
type tinyint(1) not null default '1' comment '账户类型 0.系统账户, 1.用户账户, 2.商家账户',
money_total decimal(12,2) not null default '0.00' comment '资金总额',
money_freeze decimal(12,2) not null default '0.00' comment '冻结资金',
money_left decimal(12,2) not null default '0.00' comment '余额',
jsondata json default null comment '其他',
status tinyint(1) not null default '1' comment '账户状态-1销户 0冻结 1正常',
c_time int(11) not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户资金账户表';
-- ----------------------------
-- Title:账户资金流水表
-- Author:lcc
-- Table:lc_app_user_accountlog
-- ---------------------------
drop table if exists lc_app_user_accountlog;
create table lc_app_user_accountlog (
id int(10) unsigned not null auto_increment comment 'id',
account_id int(10) unsigned not null default '0' comment '账户id',
sid varchar(32) not null default '' comment '订单号',
trade_type tinyint(4) not null default '0' comment '交易类型 1入账 2提现 3冲正 4转账',
money_type varchar(32) not null default '' comment '金额类型',
cfrom varchar(32) not null default '' comment '金额类型',
money_in decimal(12,2) not null default '0.00' comment '收入金额',
money_out decimal(12,2) not null default '0.00' comment '支出金额',
money_left decimal(12,2) not null default '0.00' comment '当前余额',
descrip varchar(255) not null default '' comment '流水说明',
jsondata json default null comment '更多数据',
status tinyint(1) not null default '0' comment ' -1失败 0进行中 1已完成',
ck varchar(32) not null default '' comment '同一批校验码',
c_time int(11) not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='账户资金流水表';
+19
View File
@@ -18,6 +18,7 @@ create table lc_app_liche_users (
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车小程序用户表';
alter table lc_app_liche_users add ifdist tinyint(1) unsigned not null default 0 comment '是否分销人员' after jsondata;
-- ----------------------------
@@ -44,3 +45,21 @@ create table lc_app_liche_cms (
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车小程序cms';
-- ----------------------------
-- Title:狸车用户数据表
-- Author:lcc
-- Table:lc_app_liche_udata
-- ---------------------------
drop table if exists lc_app_liche_udata;
create table lc_app_liche_udata (
id int(10) unsigned not null auto_increment comment '自增id',
cf_id int(10) unsigned not null default '0' comment '来源id',
type int(10) unsigned not null default '0' comment '类型(0推广素材二维码)',
datatype char(10) not null default '0' comment '数据类型 img video',
dataurl char(200) not null default '' comment '资源地址',
jsondata json default null comment '附加字段',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车用户数据表';
+34 -34
View File
@@ -4,40 +4,40 @@
-- Table:lc_order_purchase
-- ---------------------------
drop table if exists hd_order_purchase;
create table `lc_order_purchase` (
`id` int(10) unsigned not null auto_increment,
`app_id` int(10) unsigned not null comment '小程序id',
`app_uid` int(10) unsigned not null comment '小程序用户id',
`sid` varchar(32) not null default '' comment '订单号',
`item_id` int(10) unsigned not null comment '商品/服务id',
`sku_id` int(10) unsigned not null default '0' comment 'id',
`item_title` varchar(1024) not null default '' comment '商品/服务名称',
`item_num` int(10) unsigned not null default '1' comment '商品/服务数量',
`item_price` decimal(12,2) not null default '0.00' comment '商品/服务价格',
`biz_id` int(11) not null default '0' comment '商家id',
`carriage` int(10) unsigned not null default '0' comment '运费',
`total_price` decimal(12,2) not null default '0.00' comment '订单价格',
`pay_price` decimal(12,2) not null default '0.00' comment '实付金额',
`uname` varchar(16) not null default '' comment '订单用户姓名',
`mobile` varchar(11) not null default '' comment '手机号码',
`type` tinyint(1) not null default '0' comment '订单类型 1实物 2虚拟 3活动定金 4合同定金',
`payway` tinyint(1) not null default '0' comment '支付方式 0未选择 1微信',
`pay_time` timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
`jsondata` json default null comment '订单其它数据',
`descrip` varchar(255) not null default '' comment '备注/描述',
`cf_id` int(10) unsigned not null default '0' comment '来源id',
`cf_uid` int(10) unsigned not null default '0' comment '来源用户id',
`cf_platform` varchar(16) not null default '' comment '来源平台',
`status` tinyint(1) not null default '0' comment '订单状态[-2已过期 -1删除 0待支付 1已支付 2退款中 3已退款]',
`status_detail` tinyint(1) not null default '0' comment 'status',
`expire_time` int(10) unsigned not null default '0' comment '订单过期时间(0不过期)',
`express_time` timestamp not null default '0000-00-00 00:00:00' comment '发货时间',
`finish_time` timestamp not null default '0000-00-00 00:00:00' comment '交易完成时间(核销完成|确认收货)',
`c_time` int(10) unsigned not null default '0' comment '创建时间',
`u_time` timestamp not null default current_timestamp on update current_timestamp,
primary key (`id`),
key `idx_user_order` (`app_id`,`app_uid`,`status`),
key `idx_sid` (`sid`)
create table lc_order_purchase (
id int(10) unsigned not null auto_increment,
app_id int(10) unsigned not null comment '小程序id',
app_uid int(10) unsigned not null comment '小程序用户id',
sid varchar(32) not null default '' comment '订单号',
item_id int(10) unsigned not null comment '商品/服务id',
sku_id int(10) unsigned not null default '0' comment 'id',
item_title varchar(1024) not null default '' comment '商品/服务名称',
item_num int(10) unsigned not null default '1' comment '商品/服务数量',
item_price decimal(12,2) not null default '0.00' comment '商品/服务价格',
biz_id int(11) not null default '0' comment '商家id',
carriage int(10) unsigned not null default '0' comment '运费',
total_price decimal(12,2) not null default '0.00' comment '订单价格',
pay_price decimal(12,2) not null default '0.00' comment '实付金额',
uname varchar(16) not null default '' comment '订单用户姓名',
mobile varchar(11) not null default '' comment '手机号码',
type tinyint(1) not null default '0' comment '订单类型 1实物 2虚拟 3活动定金 4合同定金',
payway tinyint(1) not null default '0' comment '支付方式 0未选择 1微信',
pay_time timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
jsondata json default null comment '订单其它数据',
descrip varchar(255) not null default '' comment '备注/描述',
cf_id int(10) unsigned not null default '0' comment '来源id',
cf_uid int(10) unsigned not null default '0' comment '来源用户id',
cf_platform varchar(16) not null default '' comment '来源平台',
status tinyint(1) not null default '0' comment '订单状态[-2已过期 -1删除 0待支付 1已支付 2退款中 3已退款]',
status_detail tinyint(1) not null default '0' comment 'status',
expire_time int(10) unsigned not null default '0' comment '订单过期时间(0不过期)',
express_time timestamp not null default '0000-00-00 00:00:00' comment '发货时间',
finish_time timestamp not null default '0000-00-00 00:00:00' comment '交易完成时间(核销完成|确认收货)',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id),
key idx_user_order (app_id,app_uid,status),
key idx_sid (sid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='消费订单表';
+48 -30
View File
@@ -4,27 +4,27 @@
-- Table:lc_receiver_clues
-- ---------------------------
drop table if exists lc_receiver_clues;
create table `lc_receiver_clues` (
`id` int(10) not null auto_increment comment '自增id',
`name` varchar(32) not null comment '客户姓名',
`mobile` varchar(11) not null comment '客户手机号码',
`brand_id` int(10) not null default '0' comment '车型品牌id',
`s_id` int(10) not null default '0' comment '车系id',
`if_driver` tinyint(4) not null default '0' comment '是否试驾(0否 1是)',
`admin_id` int(10) not null default '0' comment '销售id',
`app_id` int(10) unsigned not null default '0' comment '来源小程序id',
`cf_id` int(10) not null default '0' comment '来源id',
`out_id` int(10) not null default '0' comment '外部来源id',
`cf_uid` int(10) not null default '0' comment '来源用户id',
`cf_platform` varchar(20) not null default '' comment '来源平台',
`jsondata` json default null comment '其它信息',
`status` tinyint(1) not null default '0' comment '状态',
`status_id` int(10) not null default '1',
`u_time` timestamp not null default current_timestamp on update current_timestamp,
`c_time` int(10) unsigned not null default '0' comment '创建时间',
primary key (`id`)
create table lc_receiver_clues (
id int(10) not null auto_increment comment '自增id',
name varchar(32) not null comment '客户姓名',
mobile varchar(11) not null comment '客户手机号码',
brand_id int(10) not null default '0' comment '车型品牌id',
s_id int(10) not null default '0' comment '车系id',
if_driver tinyint(4) not null default '0' comment '是否试驾(0否 1是)',
admin_id int(10) not null default '0' comment '销售id',
app_id int(10) unsigned not null default '0' comment '来源小程序id',
cf_id int(10) not null default '0' comment '来源id',
out_id int(10) not null default '0' comment '外部来源id',
cf_uid int(10) not null default '0' comment '来源用户id',
cf_platform varchar(20) not null default '' comment '来源平台',
jsondata json default null comment '其它信息',
status tinyint(1) not null default '0' comment '状态',
status_id int(10) not null default '1',
u_time timestamp not null default current_timestamp on update current_timestamp,
c_time int(10) unsigned not null default '0' comment '创建时间',
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='线索池';
alter table lc_receiver_clues add recommend_id int(10) not null default 0 comment '推荐用id' after cf_id;
-- ----------------------------
-- Title:线索操作日志表
@@ -32,14 +32,32 @@ create table `lc_receiver_clues` (
-- Table:lc_receiver_clue_oplogs
-- ---------------------------
drop table if exists lc_receiver_clue_oplogs;
create table `lc_receiver_clue_oplogs` (
`id` int(10) unsigned not null auto_increment comment '自增id',
`clue_id` int(10) unsigned not null comment '线索id',
`uid` int(10) unsigned not null comment '操作用户id',
`uname` varchar(32) not null default '' comment '操作用户名',
`type` tinyint(1) not null default '0' comment '类型',
`log` varchar(256) not null default '' comment '操作内容',
`c_time` int(10) unsigned not null default '0' comment '创建时间',
`u_time` timestamp not null default current_timestamp on update current_timestamp,
primary key (`id`)
create table lc_receiver_clue_oplogs (
id int(10) unsigned not null auto_increment comment '自增id',
clue_id int(10) unsigned not null comment '线索id',
uid int(10) unsigned not null comment '操作用户id',
uname varchar(32) not null default '' comment '操作用户名',
type tinyint(1) not null default '0' comment '类型',
log varchar(256) not null default '' comment '操作内容',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='线索操作日志表';
-- ----------------------------
-- Title:线索统计表
-- Author:lcc
-- Table:lc_receiver_clue_statistics
-- ---------------------------
drop table if exists lc_receiver_clue_statistics;
CREATE TABLE `lc_receiver_clue_statistics` (
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`app_id` int(10) unsigned NOT NULL COMMENT '应用id',
`uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`browse_num` int(10) NOT NULL DEFAULT '0' COMMENT '浏览量',
`day` date NOT NULL DEFAULT '0000-00-00' COMMENT '日期',
`c_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`u_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='线索统计表'