Commit f66921b2 authored by clone's avatar clone

新增顾客模块

parent 2b6c71ee
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/2/8
* Time : 11:31
* Intro:
*/
class Client extends Basic
{
function __construct($request = null)
{
parent::__construct($request);
}
public function selectUser(){
}
}
...@@ -4,6 +4,7 @@ namespace app\api_broker\controller; ...@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\OrderLogService; use app\api_broker\service\OrderLogService;
use app\model\OBargainModel;
use app\model\OMarchInModel; use app\model\OMarchInModel;
use app\model\ORefundModel; use app\model\ORefundModel;
...@@ -40,16 +41,17 @@ class OrderLog extends Basic ...@@ -40,16 +41,17 @@ class OrderLog extends Basic
|| !isset($params["order_id"]) || !isset($params["order_no"])) { || !isset($params["order_id"]) || !isset($params["order_no"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
/* $params = array( /* $params = array(
"reception_id" => 1,//带看经纪人id "reception_id" => 1,//带看经纪人id
"report_id" => 1,//报备id "report_id" => 1,//报备id
"order_id" =>1, //关联order表id "order_id" =>1, //关联order表id
"order_no" =>1, //订单no "order_no" =>"123123123123123", //订单no
"march_in_remark" =>1, //进场备注 "march_in_remark" =>"有意向购买", //进场备注
"march_in_img" =>1, //备注图片 "march_in_img" =>"123123", //备注图片
"march_in_area" =>1, //进场地址 "march_in_area" =>"上海市虹口区中山公园", //进场地址
);*/ );*/
$is_ok = $this->o_march_in_model->addMarchIn($params); $params["reception_id"] = $this->agentName;
$is_ok = $this->o_march_in_model->addMarchIn($params);
if ($is_ok > 0) { if ($is_ok > 0) {
return $this->response("200", "request success", []); return $this->response("200", "request success", []);
} else { } else {
...@@ -70,22 +72,22 @@ class OrderLog extends Basic ...@@ -70,22 +72,22 @@ class OrderLog extends Basic
|| !isset($params["industry_type"])) { || !isset($params["industry_type"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
/* $params = array( /* $params = array(
"agent_id" => 1,//收款经纪人id "agent_id" => 1,//收款经纪人id
"report_id" => 1,//报备id "report_id" => 111,//报备id
"order_id" => 1, //关联order表id "order_id" => 2, //关联order表id
"order_no" => 1, //订单no "order_no" => "123123123", //订单no
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他', // `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金', //`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额 存分', // `money` '入账金额 存分',
"collecting_bill" => [ [ "type" => 10, "pay_type" => 10, "money" => 1100 ], [ "type" => 10, "pay_type" => 10, "money" => 1200 ] ], "collecting_bill" => [ [ "type" => 10, "pay_type" => 10, "money" => 1100 ], [ "type" => 10, "pay_type" => 10, "money" => 1200 ] ],
"house_number" => "3301号", "house_number" => "3301号",
"industry_type" => "asdasdasd", "industry_type" => "asdasdasd",
"remark" => "没什么备注", "remark" => "没什么备注",
"transfer_img" => "12312312312" "transfer_img" => "12312312312"
);*/ );*/
$remark = isset($params["remark"]) ? $params["remark"] : ""; $remark = isset($params["remark"]) ? $params["remark"] : "";
$transfer_img = isset($params["transfer_img"]) ? $params["transfer_img"] : ""; $transfer_img = isset($params["transfer_img"]) ? $params["transfer_img"] : "";
...@@ -110,18 +112,18 @@ class OrderLog extends Basic ...@@ -110,18 +112,18 @@ class OrderLog extends Basic
|| !isset($params["refund_money"])) { || !isset($params["refund_money"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
/* $params = array( /* $params = array(
"agent_id" => 1,//退款经纪人id "agent_id" => 1,//退款经纪人id
"report_id" => 1,//报备id "report_id" => 1,//报备id
"order_id" => 1, //关联order表id "order_id" => 1, //关联order表id
"order_no" => 1, //订单no "order_no" => "12312312312312", //订单no
"refund_money" => 1200, //退款金额 存分 "refund_money" => 1200, //退款金额 存分
"name" => "qweqwe", //收款人姓名 "name" => "qweqwe", //收款人姓名
"bank" => "asdasdasd", //收款人银行 "bank" => "asdasdasd", //收款人银行
"card_no" => "123123123123", //银行卡号 "card_no" => "123123123123", //银行卡号
"remark" => "没什么备注", "remark" => "没什么备注",
"remark_img" => "12312312312" "remark_img" => "12312312312"
);*/ );*/
//todo 判断此单是否有付款 //todo 判断此单是否有付款
$is_ok = $this->o_refund_model->addRefund($params); $is_ok = $this->o_refund_model->addRefund($params);
if ($is_ok > 0) { if ($is_ok > 0) {
...@@ -144,24 +146,24 @@ class OrderLog extends Basic ...@@ -144,24 +146,24 @@ class OrderLog extends Basic
|| !isset($params["commission_arr"][0]["scale"]) || !isset($params["commission_arr"][0]["scale_fee"])) { || !isset($params["commission_arr"][0]["scale"]) || !isset($params["commission_arr"][0]["scale_fee"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
/* $params = array( /* $params = array(
"submit_agent_id" => 1,//申请经纪人id "submit_agent_id" => 1,//申请经纪人id
"report_id" => 1,//报备id "report_id" => 1,//报备id
"order_id" => 1, //关联order表id "order_id" => 1, //关联order表id
"order_no" => 1, //订单no "order_no" => "123123123", //订单no
"trade_type" => 1, //成交类型 10出租 20 增佣 30 代理 40 好处费 "trade_type" => 10, //成交类型 10出租 20 增佣 30 代理 40 好处费
"price" => 1, //成交价格 存分 "price" => 112131, //成交价格 存分
"commission" => 1, //佣金 存分 "commission" => 111, //佣金 存分
//`role` '分佣方 1盘方 2客方 3 反签 4独家 5合作方', //`role` '分佣方 1盘方 2客方 3 反签 4独家 5合作方',
//`agent_id`'分佣经纪人id', //`agent_id`'分佣经纪人id',
//`scale`'分佣比例 如 5表示百分之5', //`scale`'分佣比例 如 5表示百分之5',
// `scale_fee` '应分佣金 存分 ', // `scale_fee` '应分佣金 存分 ',
"commission_arr" => [ [ "role" => 10, "agent_id" => 10, "scale" => 10, "scale_fee" => 1222 ], "commission_arr" => [ [ "role" => 10, "agent_id" => 10, "scale" => 10, "scale_fee" => 1222 ],
[ "role" => 10, "agent_id" => 10, "scale" => 10, "scale_fee" => 1222 ] ], [ "role" => 11, "agent_id" => 12, "scale" => 13, "scale_fee" => 1112 ] ],
);*/ );*/
$is_ok = $this->service_->addBargain($params["submit_agent_id"], $params["report_id"], $params["order_id"], $params["order_no"], $is_ok = $this->service_->addBargain($params["submit_agent_id"], $params["report_id"], $params["order_id"], $params["order_no"],
$params["trade_type"], $params["price"], $params["commission"], $params["commission_arr"]); $params["trade_type"], $params["price"], $params["commission"], $params["commission_arr"]);
...@@ -173,15 +175,55 @@ class OrderLog extends Basic ...@@ -173,15 +175,55 @@ class OrderLog extends Basic
} }
public function selectReportAll(){ /**
* 报备时间轴
* @return \think\Response
*/
public function selectReportAll()
{
$params = $this->params; $params = $this->params;
if(!isset($params["order_no"])){ if (!isset($params["order_no"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$params = array( $params = array(
"order_no" =>"1212312312", "order_no" => "1212312312",
); );
$data = $this->service_->selectListByOrderNo($params["order_no"]); $data = $this->service_->selectListByOrderNo($params["order_no"]);
} }
/**
* 修改成单状态
* @return \think\Response
*/
public function statusBargain()
{
$params = $this->params;
/* $params = array(
"id" => 1,
"type" => 210 //20撤销 21已撤销 30已审核
);*/
if (!isset($params["id"])) {
return $this->response("101", "请求参数错误");
}
if (!isset($params["type"]) || $params["type"] != 20 && $params["type"] != 21 && $params["type"] != 30) {
return $this->response("101", "要修改的状态类型错误");
}
$obm = new OBargainModel();
$save_param["status"] = $params["type"];
$is_ok = $obm->updateBargainById($params["id"], $save_param);
if ($is_ok > 0) {
return $this->response("200", "request success", [ "msg" => "状态修改成功" ]);
} else {
return $this->response("101", "request error");
}
}
} }
\ No newline at end of file
...@@ -37,18 +37,17 @@ class Report extends Basic ...@@ -37,18 +37,17 @@ class Report extends Basic
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
/* $params = array( /* $params = array(
"report_agent_id" => 1,//报备经纪人id "report_agent_id" => 1,//报备经纪人id
"report_store_id" => 1,//门店id "report_store_id" => 1,//门店id
"user_id" => 1,//用户id "user_id" => 1,//用户id
"house_ids" => "1,2,3",//楼盘id "house_ids" => "1,2,3",//楼盘id
"vehicle" => 10,//交通工具 "vehicle" => 10,//交通工具
"intro" => "123123123",//备注 "intro" => "123123123",//备注
"predict_see_time" => date("Y-m-d H:i:s", time()),//预计到看时间 "predict_see_time" => time(),//预计到看时间
);*/ );*/
//todo 检查经纪人状态 basic类做 //todo 检查经纪人状态 basic类做
//todo 验证用户id是否正常
$agent_id = $params["report_agent_id"]; $agent_id = $params["report_agent_id"];
$store_id = $params["report_store_id"]; $store_id = $params["report_store_id"];
...@@ -58,7 +57,15 @@ class Report extends Basic ...@@ -58,7 +57,15 @@ class Report extends Basic
$intro = $params["intro"]; $intro = $params["intro"];
$predict_see_time = $params["predict_see_time"]; $predict_see_time = $params["predict_see_time"];
$is_ok = $this->service_->verifyReport($agent_id, $store_id, $user_id, $house_ids, $vehicle, $intro, $predict_see_time); //todo 验证用户id是否正常
$userArr = $this->service_->verifyUser($user_id);
if (!$userArr) {
return $this->response("101", "不存在此用户");
}
$is_ok = $this->service_->verifyReport($agent_id, $this->agentName, $store_id, $user_id, $userArr["user_phone"],
$userArr["user_name"], $house_ids, $vehicle, $intro, $predict_see_time);
if ($is_ok > 0) { if ($is_ok > 0) {
return $this->response("200", "request success", []); return $this->response("200", "request success", []);
} else { } else {
...@@ -68,14 +75,6 @@ class Report extends Basic ...@@ -68,14 +75,6 @@ class Report extends Basic
} }
/**
* 根据报备的编号 进场
* @return \think\Response
*/
public function marchInByOrderId()
{
return $this->response();
}
/** /**
* 新增跟进 * 新增跟进
...@@ -83,7 +82,7 @@ class Report extends Basic ...@@ -83,7 +82,7 @@ class Report extends Basic
*/ */
public function addFollowUp() public function addFollowUp()
{ {
/*$params = array( $params = array(
"report_id" => 1, "report_id" => 1,
"agent_id" => 12, "agent_id" => 12,
"user_type" =>"1,2", // 用户类型 "user_type" =>"1,2", // 用户类型
...@@ -98,14 +97,14 @@ class Report extends Basic ...@@ -98,14 +97,14 @@ class Report extends Basic
"other_area" =>"1,2",//其他地区 "other_area" =>"1,2",//其他地区
"explain" =>"1,2",//备注 "explain" =>"1,2",//备注
"explain_img" =>"1,2"//备注图 "explain_img" =>"1,2"//备注图
);*/ );
$params = $this->params; //$params = $this->params;
if (!isset($params['report_id']) || !isset($params['agent_id']) || !isset($params['user_type']) || if (!isset($params['report_id']) || !isset($params['agent_id']) || !isset($params['user_type']) ||
!isset($params['industry_type']) || !isset($params['area_requirement']) || !isset($params['price_requirement'])) { !isset($params['industry_type']) || !isset($params['area_requirement']) || !isset($params['price_requirement'])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$params["agent_name"] = $this->agentName;
$is_ok = $this->fulModel->addFollowUpLog($params); $is_ok = $this->fulModel->addFollowUpLog($params);
if ($is_ok > 0) { if ($is_ok > 0) {
return $this->response("200", "request success", []); return $this->response("200", "request success", []);
...@@ -139,7 +138,7 @@ class Report extends Basic ...@@ -139,7 +138,7 @@ class Report extends Basic
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"]; $where_["agent_id"] = $params["agent_id"];
} }
$result = $this->fulModel->selectFollowUpList($field_, $where_,$order_); $result = $this->fulModel->selectFollowUpList($field_, $where_, $order_);
if (count($result) > 0) { if (count($result) > 0) {
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} else { } else {
......
...@@ -9,6 +9,7 @@ namespace app\api_broker\extend; ...@@ -9,6 +9,7 @@ namespace app\api_broker\extend;
* Time: 9:35 * Time: 9:35
* 基类 * 基类
*/ */
use app\model\AAgents;
use app\model\Users; use app\model\Users;
use think\Controller; use think\Controller;
use think\Request; use think\Request;
...@@ -30,9 +31,9 @@ class Basic extends Controller ...@@ -30,9 +31,9 @@ class Basic extends Controller
/** /**
* @var int userId * @var int userId
*/ */
protected $userId; protected $agentId;
protected $userNick; protected $agentName;
protected $phone; protected $agentPhone;
protected $timeStamp_; protected $timeStamp_;
protected $filterVerify = array( protected $filterVerify = array(
...@@ -81,7 +82,7 @@ class Basic extends Controller ...@@ -81,7 +82,7 @@ class Basic extends Controller
echo json_encode(array( "code" => "300", "msg" => "AuthToken不能为空!", "data" => [], "type" => "json" )); echo json_encode(array( "code" => "300", "msg" => "AuthToken不能为空!", "data" => [], "type" => "json" ));
exit; exit;
} }
$this->verifyUserInfo(); $this->verifyAgentInfo();
$this->verifyTime(); $this->verifyTime();
} }
...@@ -95,11 +96,11 @@ class Basic extends Controller ...@@ -95,11 +96,11 @@ class Basic extends Controller
} }
} }
public function verifyUserInfo() public function verifyAgentInfo()
{ {
$userModel = new Users(); $agentModel = new AAgents();
$userArr = $userModel->selectUser($this->userId); $agentArr = $agentModel->getAgentById("id,store_id,name,phone");
if (count($userArr) > 0 && ($userArr["id"] != $this->userId || $userArr["user_phone"] != $this->phone)) { if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId || $agentArr["user_phone"] != $this->agentPhone)) {
echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" )); echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" ));
exit; exit;
} }
......
...@@ -52,6 +52,7 @@ class OrderLogService ...@@ -52,6 +52,7 @@ class OrderLogService
$house_number, $industry_type, $remark, $transfer_img)); $house_number, $industry_type, $remark, $transfer_img));
} }
} }
dump($bill_arr);
//todo if bill_arr not null, save database table //todo if bill_arr not null, save database table
if (!empty($bill_arr)) { if (!empty($bill_arr)) {
return $this->payLogModel->addPayLog($bill_arr); return $this->payLogModel->addPayLog($bill_arr);
...@@ -96,12 +97,14 @@ class OrderLogService ...@@ -96,12 +97,14 @@ class OrderLogService
{ {
$bargain_arr = []; $bargain_arr = [];
foreach ($commission_arr as $commission_val) { foreach ($commission_arr as $commission_val) {
if (isset($collecting["role"]) && isset($collecting["agent_id"]) && isset($collecting["scale"]) && isset($collecting["scale_fee"])) { if (isset($commission_val["role"]) && isset($commission_val["agent_id"]) && isset($commission_val["scale"]) && isset($commission_val["scale_fee"])) {
array_push($bargain_arr, $this->bargainBin($commission_val, $submit_agent_id, $report_id, $order_id, array_push($bargain_arr, $this->bargainBin($commission_val, $submit_agent_id, $report_id, $order_id,
$order_no, $trade_type, $price, $commission)); $order_no, $trade_type, $price, $commission));
} }
} }
//todo if bill_arr not null, save database table //todo if bill_arr not null, save database table
dump($bargain_arr);
if (!empty($bargain_arr)) { if (!empty($bargain_arr)) {
return $this->bargainModel->addBargain($bargain_arr); return $this->bargainModel->addBargain($bargain_arr);
} }
...@@ -206,4 +209,5 @@ class OrderLogService ...@@ -206,4 +209,5 @@ class OrderLogService
return array(); return array();
} }
} }
\ No newline at end of file
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
namespace app\api_broker\service; namespace app\api_broker\service;
use app\model\GHouses;
use app\model\HouseInfos;
use app\model\OrderModel; use app\model\OrderModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\Users;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
...@@ -24,21 +27,44 @@ class ReportService ...@@ -24,21 +27,44 @@ class ReportService
$this->orderModel = new OrderModel(); $this->orderModel = new OrderModel();
} }
/**
* 验证用户信息
* @param $user_id
* @return array|null
*/
public function verifyUser($user_id)
{
$userResult = [];
$userModel = new Users();
$userArr = $userModel->selectUser($user_id, "id,user_nick,user_phone");
if (count($userArr) > 0) {
$userResult["user_phone"] = $userArr["user_phone"];
$userResult["user_name"] = $userArr["user_nick"];
} else {
return null;
}
return $userResult;
}
/** /**
* 生成报备和保存订单 * 生成报备和保存订单
* @param $agent_id * @param $agent_id
* @param $agent_name
* @param $store_id * @param $store_id
* @param $user_id * @param $user_id
* @param $user_phone
* @param $user_name
* @param $house_ids * @param $house_ids
* @param $vehicle * @param $vehicle
* @param $intro * @param $intro
* @param $predict_see_time * @param $predict_see_time
* @return int * @return int
*/ */
public function verifyReport($agent_id, $store_id, $user_id, $house_ids, $vehicle, $intro, $predict_see_time) public function verifyReport($agent_id, $agent_name, $store_id, $user_id, $user_phone, $user_name, $house_ids, $vehicle, $intro, $predict_see_time)
{ {
$id = $this->reportBin($agent_id, $store_id, $user_id, $vehicle, $intro, $predict_see_time); $id = $this->reportBin($agent_id, $agent_name, $store_id, $user_id, $user_phone, $user_name, $vehicle, $intro,
$predict_see_time);
if ($id > 0) { if ($id > 0) {
$house_arr = explode(",", $house_ids); $house_arr = explode(",", $house_ids);
...@@ -65,27 +91,33 @@ class ReportService ...@@ -65,27 +91,33 @@ class ReportService
return time() . mt_rand(100000, 999999); return time() . mt_rand(100000, 999999);
} }
/** /**报备主表
* 报备主表
* @param $report_agent_id * @param $report_agent_id
* @param $report_agent_name
* @param $report_store_id * @param $report_store_id
* @param $user_id * @param $user_id
* @param $user_phone
* @param $user_name
* @param $vehicle * @param $vehicle
* @param $intro * @param $intro
* @param $predict_see_time * @param $predict_see_time
* @return array * @return array
*/ */
private function reportBin($report_agent_id, $report_store_id, $user_id, $vehicle, $intro, $predict_see_time) private function reportBin($report_agent_id, $report_agent_name, $report_store_id, $user_id, $user_phone, $user_name,
$vehicle, $intro, $predict_see_time)
{ {
$param["report_agent_id"] = $report_agent_id; $param["report_agent_id"] = $report_agent_id;
$param["report_store_id"] = $report_store_id; $param["report_agent_name"] = $report_agent_name;
$param["user_id"] = $user_id; $param["report_store_id"] = $report_store_id;
$param["vehicle"] = $vehicle; $param["user_id"] = $user_id;
$param["status"] = 0; $param["user_phone"] = $user_phone;
$param["intro"] = $intro; $param["user_name"] = $user_name;
$param["predict_see_time"] = date("Y-m-d H:i:s", $predict_see_time); $param["vehicle"] = $vehicle;
$param["create_time"] = date("Y-m-d H:i:s", time()); $param["status"] = 0;
$param["update_time"] = date("Y-m-d H:i:s", time()); $param["intro"] = $intro;
$param["predict_see_time"] = date("Y-m-d H:i:s", $predict_see_time);
$param["create_time"] = date("Y-m-d H:i:s", time());
$param["update_time"] = date("Y-m-d H:i:s", time());
return $this->reportModel->addReport($param); return $this->reportModel->addReport($param);
} }
...@@ -98,9 +130,15 @@ class ReportService ...@@ -98,9 +130,15 @@ class ReportService
*/ */
private function orderBin($order_no, $f_id, $house_id) private function orderBin($order_no, $f_id, $house_id)
{ {
$param["order_no"] = $order_no; $houseModel = new GHouses();
$param["f_id"] = $f_id; $houseResult = $houseModel->getHouseDetail("id,internal_title",["id"=>$house_id]);
$param["house_id"] = $house_id; $house_title = count($houseResult) > 0 && isset($houseResult["internal_title"]) ? $houseResult["internal_title"] : null ;
$param["order_no"] = $order_no;
$param["f_id"] = $f_id;
$param["house_id"] = $house_id;
$param["house_title"] = $house_title;
$param["create_time"] = date("Y-m-d H:i:s", time());
$param["update_time"] = date("Y-m-d H:i:s", time());
return $param; return $param;
} }
......
...@@ -144,10 +144,10 @@ public function saveList(){ ...@@ -144,10 +144,10 @@ public function saveList(){
*/ */
public function verifyUser($field,$join,$params) public function verifyUser($field,$join,$params)
{ {
$r= $this->field($field) $r= $this->field($field)
->alias('a') ->alias('a')
->join($join) ->join($join)
->where($params) ->where($params)
->find(); ->find();
//echo $this->getLastSql(); //echo $this->getLastSql();
...@@ -205,4 +205,24 @@ public function saveList(){ ...@@ -205,4 +205,24 @@ public function saveList(){
->count(); ->count();
} }
/**
* 获取经纪人
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAgentById($field = "id",$params){
$where_ = [];
if(isset($params["agent_id"])){
$where_["id"] = $params["agent_id"];
}
return $this->field($field)
->where($where_)
->select();
}
} }
\ No newline at end of file
...@@ -367,4 +367,18 @@ class GHouses extends BaseModel ...@@ -367,4 +367,18 @@ class GHouses extends BaseModel
} }
return $return; return $return;
} }
/**
* 获取商铺详情
* @param $field
* @param $params
* @return mixed
*/
function getHouseDetail($field, $params)
{
return $data = $this
->field($field)
->where($params)
->find();
}
} }
...@@ -26,7 +26,27 @@ class OBargainModel extends Model ...@@ -26,7 +26,27 @@ class OBargainModel extends Model
{ {
Db::startTrans(); Db::startTrans();
try { try {
$this->db->inserAll($params); $this->db_->insertAll($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 修改信息
* @param $id
* @param $params
* @return int
*/
public function updateBargainById($id, $params)
{
$params["update_time"] = date("Y-m-d H:i:s", time());
Db::startTrans();
try {
$this->db_->where('id', $id)->update($params);
Db::commit(); Db::commit();
return 1; return 1;
} catch (\Exception $e) { } catch (\Exception $e) {
...@@ -41,7 +61,7 @@ class OBargainModel extends Model ...@@ -41,7 +61,7 @@ class OBargainModel extends Model
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function selectBargainByOrderNo($filed , $params) public function selectBargainByOrderNo($filed, $params)
{ {
$where_ = []; $where_ = [];
if (isset($params["report_id"])) { if (isset($params["report_id"])) {
......
...@@ -33,7 +33,7 @@ class OMarchInModel extends Model ...@@ -33,7 +33,7 @@ class OMarchInModel extends Model
$params["update_time"] = date("Y-m-d H:i:s", time()); $params["update_time"] = date("Y-m-d H:i:s", time());
Db::startTrans(); Db::startTrans();
try { try {
$this->db->inser($params); $this->db_model->insert($params);
Db::commit(); Db::commit();
return 1; return 1;
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -26,7 +26,7 @@ class OPayLogModel extends Model ...@@ -26,7 +26,7 @@ class OPayLogModel extends Model
{ {
Db::startTrans(); Db::startTrans();
try { try {
$this->db->inserAll($params); $this->db_->insertAll($params);
Db::commit(); Db::commit();
return 1; return 1;
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -35,7 +35,7 @@ class OReportModel extends Model ...@@ -35,7 +35,7 @@ class OReportModel extends Model
Db::startTrans(); Db::startTrans();
try { try {
$this->db->insert($params); $this->db->insert($params);
$id = $this->id; $id = $this->db->getLastInsID();
Db::commit(); Db::commit();
return $id; return $id;
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -26,7 +26,7 @@ class OrderModel extends Model ...@@ -26,7 +26,7 @@ class OrderModel extends Model
{ {
Db::startTrans(); Db::startTrans();
try { try {
$this->db->inserAll($params); $this->db_->insertAll($params);
Db::commit(); Db::commit();
return 1; return 1;
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -209,6 +209,10 @@ Route::group('broker', [ ...@@ -209,6 +209,10 @@ Route::group('broker', [
'addFollowUp' => [ 'api_broker/Report/addFollowUp', [ 'method' => 'get|post' ] ], //新增跟进 'addFollowUp' => [ 'api_broker/Report/addFollowUp', [ 'method' => 'get|post' ] ], //新增跟进
'getFollowUpList' => [ 'api_broker/Report/getFollowUpList', [ 'method' => 'get|post' ] ], 'getFollowUpList' => [ 'api_broker/Report/getFollowUpList', [ 'method' => 'get|post' ] ],
'marchIn' => [ 'api_broker/OrderLog/marchIn', [ 'method' => 'get|post' ] ], 'marchIn' => [ 'api_broker/OrderLog/marchIn', [ 'method' => 'get|post' ] ],
'collectingBill' => [ 'api_broker/OrderLog/collectingBill', [ 'method' => 'get|post' ] ],
'refund' => [ 'api_broker/OrderLog/refund', [ 'method' => 'get|post' ] ],
'bargain' => [ 'api_broker/OrderLog/bargain', [ 'method' => 'get|post' ] ],
'statusBargain' => [ 'api_broker/OrderLog/statusBargain', [ 'method' => 'get|post' ] ],
]); ]);
//Route::miss('api/index/miss');//处理错误的url //Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment