edit-api-sign

This commit is contained in:
lccsw
2021-07-22 11:04:33 +08:00
parent d057c17275
commit fd91c0556c
18 changed files with 82 additions and 33 deletions
@@ -27,6 +27,7 @@ class Agent extends HD_Controller{
$t1 = 'lc_receiver_order_agents';
$t2 = 'lc_receiver_orders';
$where = [
"$t2.id>" => 0,
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
@@ -27,6 +27,7 @@ class Bill extends HD_Controller{
$t1 = 'lc_receiver_order_bills';
$t2 = 'lc_receiver_orders';
$where = [
"$t2.id>" => 0,
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
@@ -27,6 +27,7 @@ class Ckcar extends HD_Controller{
$t1 = 'lc_receiver_order_ckcars';
$t2 = 'lc_receiver_orders';
$where = [
"$t2.id>" => 0,
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
@@ -27,6 +27,7 @@ class Delivery extends HD_Controller{
$t1 = 'lc_receiver_order_deliverys';
$t2 = 'lc_receiver_orders';
$where = [
"$t2.id>" => 0,
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
@@ -24,6 +24,7 @@ class Loan extends HD_Controller{
$t1 = 'lc_receiver_order_loans';
$t2 = 'lc_receiver_orders';
$where = [
"$t2.id>" => 0,
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
+3 -1
View File
@@ -24,9 +24,11 @@ class Sign extends HD_Controller{
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$where = [];
$t1 = 'lc_receiver_order_signs';
$t2 = 'lc_receiver_orders';
$where = [
"$t2.id>" => 0,
];
strlen($params['status']) && $where["$t1.status"] = $params['status'];
+5 -7
View File
@@ -22,7 +22,7 @@ class Contract extends Wxapp{
$this->load->model('receiver/order/receiver_order_contracts_model','contracts_model');
$this->load->model('receiver/order/receiver_order_ckcars_model','ckcars_model');
$this->load->model('receiver/order/receiver_order_bills_model','bills_model');
$this->load->model('receiver/order/receiver_order_deliverys_model','deliverys_model');
$this->load->model('receiver/order/receiver_order_deliverys_model','deliverys_model');
}
protected function get(){
@@ -111,7 +111,7 @@ class Contract extends Wxapp{
switch($type){
case 0: //整车
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,1050,200,300);
$res = $this->sign_entity->merge($sign_img,$img,1050,230,300);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
@@ -131,7 +131,7 @@ class Contract extends Wxapp{
break;
case 1: //协议
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,1050,1550,300);
$res = $this->sign_entity->merge($sign_img,$img,1050,1600,300);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
@@ -144,10 +144,8 @@ class Contract extends Wxapp{
];
$result = $this->contracts_model->update($update,['id'=>$row['id']]);
if($result){
$this->signs_model->update(['status'=>1],['o_id'=>$id]);
//生成定金订单
$this->load->library('receiver/orders_entity');
$this->orders_entity->c_order($id,$this->app_id,$this->session);
$this->orders_entity->sign_after($id,$this->app_id,$this->session);
throw new Exception('签名成功', API_CODE_SUCCESS);
}else{
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
@@ -155,7 +153,7 @@ class Contract extends Wxapp{
break;
case 2: //确认信息
$sign_img = array_pop($imgs);
$res = $this->sign_entity->merge($sign_img,$img,1050,400,300);
$res = $this->sign_entity->merge($sign_img,$img,1050,430,300);
if(!$res){
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
}
+1 -1
View File
@@ -332,7 +332,7 @@ class User extends Wxapp{
'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']
['title'=>'联系狸','icon'=>'https://qs.haodian.cn/wechat_app/liche/mine/list-icon-3.png']
],
'order' => [
['title' => '全部订单', 'icon' => 'https://qs.haodian.cn/wechat_app/liche/mine/order-icon-1.png', 'url' => '/pages/order/index?typeId=0'],
@@ -53,6 +53,10 @@ class Cusorder extends Wxapp{
if(!$row || !$series_row){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
//判断是否存在未完成流程
if($this->orders_model->get_step($row['mobile'])){
throw new Exception('该手机号用户存在未完成订单', API_CODE_FAIL);
}
$where = [
"id in ($v_id,$color_id,$incolor_id)" => null
];
+9 -5
View File
@@ -101,6 +101,9 @@ class Customers extends Wxapp{
if(!$name || !$car_id || !$v_id || !$color_id){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
if($this->customers_model->count(['biz_id'=>$biz_id,'mobile'=>$mobile])){
throw new Exception('客户已存在', API_CODE_FAIL);
}
$row = $this->auto_series_model->get(['id'=>$car_id]);
$where = [
"id in ($v_id,$color_id)" => null
@@ -352,14 +355,14 @@ class Customers extends Wxapp{
$admin_id = $this->input_param('admin_id');
$admin = $this->app_user_model->get(['id'=>$admin_id,'status'=>1]);
if (!$ids || !$admin) {
if (!$id_arr || !$admin) {
throw new Hd_exception('参数错误', API_CODE_INVILD_PARAM);
}
$ids = implode(',', $id_arr);
$ret = $this->customers_model->update(['admin_id' => $admin_id], ["id in ({$ids})" => null]);
if (is_bool($ret)) {
debug_log("[error]# " . $this->orders_model->db->last_query(), __FUNCTION__, $this->log_dir);
debug_log("[error]# " . $this->customers_model->db->last_query(), __FUNCTION__, $this->log_dir);
throw new Exception('分派失败', API_CODE_FAIL);
}
//写日志
@@ -367,10 +370,11 @@ class Customers extends Wxapp{
$this->load->library('receiver/customers_entity');
$customers = $this->customers_model->get_map_by_ids ($id_arr,'id,rid');
foreach($id_arr as $val){
if($customers[$val]['rid']){ //更新线索跟进人
$this->clues_model->update(['admin_id'=>$admin_id,'status'=>2],['id'=>$customers[$val]['rid']]);
$rid = $customers[$val][0]['rid']; //线索id
if($rid){ //更新线索跟进人
$this->clues_model->update(['admin_id'=>$admin_id,'status'=>2],['id'=>$rid]);
}
$log = "$uname】分配客户";
$log = "{$uname}】分配客户";
$this->customers_entity->add_log($val,$uid,$uname,$log);
}
throw new Exception('分配成功', API_CODE_SUCCESS);
+48 -13
View File
@@ -45,22 +45,57 @@ class Orders_entity{
}
/**
* 创建定金消费订单
* @param $oid int 订单id
* return boolean
* 签完成协议后操作
* @param $oid int 订单id
* @param $app_id int 小程序id
* @param $userinfo array() 小程序用户信息
*/
public function c_order($oid,$app_id,$userinfo){
public function sign_after($oid,$app_id,$userinfo){
$this->ci->load->model('receiver/order/receiver_orders_model','orders_model');
$this->ci->load->model('receiver/order/receiver_order_signs_model','signs_model');
$this->ci->load->model('receiver/receiver_customers_model','customers_model');
$this->ci->load->model('apporder/order_purchase_model');
$this->ci->load->model('auto/auto_series_model');
$this->ci->load->model('auto/auto_brand_model');
$row = $this->ci->orders_model->get(['id'=>$oid]);
if(!$row){
return false;
}
$brand = $this->ci->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->ci->auto_series_model->get(['id'=>$row['s_id']],'name');
$car_json = json_decode($row['car_json'],true);
$customers = $this->ci->customers_model->get(['id'=>$row['rid']],'rid');
$ifpay = false;
if($customers['rid']){ //判断线索是否支付定金
$ifpay = $this->ci->order_purchase_model->count(['type'=>3,'status'=>2,'cf_id'=>$customers['rid'],'app_id'=>$app_id,'app_uid'=>$userinfo['uid']]);
}
if($ifpay){
$this->ci->signs_model->update(['status'=>2],['o_id'=>$oid]);
if($row['payway']){//全款
$status = 2;
$this->ci->load->model('receiver/order/receiver_order_ckcars_model','next_model');
}else{
$status = 1;
$this->ci->load->model('receiver/order/receiver_order_loans_model','next_model');
}
$res = $this->ci->orders_model->update(['status'=>$status],['id'=>$row['id']]);
if($res){
$this->ci->next_model->add(['o_id'=>$row['id'],'c_time'=>time()]);
}
}else{
$this->ci->signs_model->update(['status'=>1],['o_id'=>$row['id']]);
$res = $this->c_order($row,$app_id,$userinfo);
}
return $res;
}
/**
* 创建定金消费订单
* @param $oder array 订单数据
* return boolean
*/
public function c_order($order,$app_id,$userinfo){
$this->ci->load->model('apporder/order_purchase_model');
$this->ci->load->model('auto/auto_series_model');
$this->ci->load->model('auto/auto_brand_model');
$brand = $this->ci->auto_brand_model->get(['id'=>$order['brand_id']],'name');
$series = $this->ci->auto_series_model->get(['id'=>$order['s_id']],'name');
$car_json = json_decode($order['car_json'],true);
$color = isset($car_json['color']) ? $car_json['color'] : '';
$sid = create_order_no(350200,'liche',1,2);
@@ -72,12 +107,12 @@ class Orders_entity{
'app_id' => $app_id,
'app_uid' => $userinfo['uid'],
'sid' => $sid,
'item_id' => $row['id'],
'item_id' => $order['id'],
'item_title' => $brand['name'].$series['name'],
'item_num' => 1,
'type' => 4,
'item_price' => $row['deposit'],
'total_price' => $row['deposit'],
'item_price' => $order['deposit'],
'total_price' => $order['deposit'],
'uname' => $userinfo['nickname'],
'mobile' => $userinfo['mobile'],
'payway' => 1,
@@ -85,7 +120,7 @@ class Orders_entity{
'status_detail' => 11,
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE),
'c_time' => time(),
'cf_id' => $oid
'cf_id' => $order['id']
];
$result = $this->ci->order_purchase_model->add($add_data);
return $result;
+1 -1
View File
@@ -42,7 +42,7 @@ class Sign_entity{
!$s_path && $s_path = FCPATH.'temp/'.md5('sign'.$file_name).'.jpg';
$yhdata = file_get_contents($user_file,false,stream_context_create($arrContextOptions));
$yh_image = Image::fromData($yhdata)->cropResize(150,150)->rotate(-90);
$yh_image = Image::fromData($yhdata)->cropResize(150,150)->rotate(90);
//原始签名文件
@@ -19,6 +19,7 @@ class App_licheb_users_model extends HD_Model{
*/
public function get_map_by_ids($ids,$fileds=''){
$rows = [];
$ids = array_filter($ids);
if($ids){
$cf_ids = implode(',',$ids);
$where = [
+1 -1
View File
@@ -25,8 +25,8 @@ class Auto_attr_model extends HD_Model{
public function get_map_by_ids($ids, $fileds = '')
{
$rows = [];
$ids = array_filter($ids);
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
+1 -1
View File
@@ -27,8 +27,8 @@ class Auto_brand_model extends HD_Model
public function get_map_by_ids($ids, $fileds = '')
{
$rows = [];
$ids = array_filter($ids);
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
+1 -1
View File
@@ -25,8 +25,8 @@ class Auto_series_model extends HD_Model{
public function get_map_by_ids($ids, $fileds = '')
{
$rows = [];
$ids = array_filter($ids);
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
@@ -23,8 +23,8 @@ class Receiver_clues_cfrom_model extends HD_Model
*/
public function get_map_by_ids($ids,$fileds=''){
$rows = [];
$ids = array_filter($ids);
if($ids){
$ids = array_filter($ids);
if($ids){
$cf_ids = implode(',',$ids);
$where = [
@@ -27,8 +27,8 @@ class Receiver_customers_model extends HD_Model
public function get_map_by_ids($ids, $fileds = '')
{
$rows = [];
$ids = array_filter($ids);
if ($ids) {
$ids = array_filter($ids);
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null