作者 郭鑫

end

@@ -257,4 +257,8 @@ return [ @@ -257,4 +257,8 @@ return [
257 'cmf_default_theme' => 'simpleboot3', 257 'cmf_default_theme' => 'simpleboot3',
258 'cmf_admin_theme_path' => 'themes/admin/', 258 'cmf_admin_theme_path' => 'themes/admin/',
259 'cmf_admin_default_theme' => 'simpleboot3', 259 'cmf_admin_default_theme' => 'simpleboot3',
  260 + 'wx_appid' => 'wxf69d1d87d173c899',
  261 + 'wx_appsecret' => '93c020c51020d87bda1c0bd98b527ff5',
  262 + 'wx_mch_id' => '1507884301',
  263 + 'wx_key' => 'VaY3CqbFLbq2Dw3FRENrixu24E9Qq1ZI',
260 ]; 264 ];
@@ -20,6 +20,8 @@ class AlipayController extends NotifyCommonController @@ -20,6 +20,8 @@ class AlipayController extends NotifyCommonController
20 require_once VENDOR_PATH.'alipay/config.php'; 20 require_once VENDOR_PATH.'alipay/config.php';
21 require_once VENDOR_PATH.'alipay/pagepay/service/AlipayTradeService.php'; 21 require_once VENDOR_PATH.'alipay/pagepay/service/AlipayTradeService.php';
22 require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradePagePayContentBuilder.php'; 22 require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradePagePayContentBuilder.php';
  23 + require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradeRefundContentBuilder.php';
  24 + require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradeFastpayRefundQueryContentBuilder.php';
23 $this->config = $config; 25 $this->config = $config;
24 } 26 }
25 27
@@ -108,6 +110,42 @@ class AlipayController extends NotifyCommonController @@ -108,6 +110,42 @@ class AlipayController extends NotifyCommonController
108 return $response; 110 return $response;
109 } 111 }
110 112
  113 + // 退款查询
  114 + public function refundquery($data) {
  115 +
  116 + $config = $this->config;
  117 + //商户订单号,商户网站订单系统中唯一订单号
  118 + $out_trade_no = '';
  119 + if(!empty($data['out_trade_no'])) {
  120 + $out_trade_no = trim($data['out_trade_no']);
  121 + }
  122 +
  123 + //支付宝交易号
  124 + if(!empty($data['trade_no'])) {
  125 + $trade_no = trim($data['trade_no']);
  126 + }
  127 + //请二选一设置
  128 +
  129 + //请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号,必填
  130 + $out_request_no = trim($data['out_request_no']);
  131 +
  132 + //构造参数
  133 + $RequestBuilder=new \AlipayTradeFastpayRefundQueryContentBuilder();
  134 + $RequestBuilder->setOutTradeNo($out_trade_no);
  135 + $RequestBuilder->setTradeNo($trade_no);
  136 + $RequestBuilder->setOutRequestNo($out_request_no);
  137 +
  138 + $aop = new \AlipayTradeService($config);
  139 +
  140 + /**
  141 + * 退款查询 alipay.trade.fastpay.refund.query (统一收单交易退款查询)
  142 + * @param $builder 业务参数,使用buildmodel中的对象生成。
  143 + * @return $response 支付宝返回的信息
  144 + */
  145 + $response = $aop->refundQuery($RequestBuilder);
  146 + return $response;
  147 + }
  148 +
111 // 回调 149 // 回调
112 public function notify_url() { 150 public function notify_url() {
113 $config = $this->config; 151 $config = $this->config;
@@ -182,6 +220,7 @@ class AlipayController extends NotifyCommonController @@ -182,6 +220,7 @@ class AlipayController extends NotifyCommonController
182 $where['order_sn'] = $data['out_trade_no']; 220 $where['order_sn'] = $data['out_trade_no'];
183 // $where['money'] = $data['total_amount']; 221 // $where['money'] = $data['total_amount'];
184 $res = $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付'); 222 $res = $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付');
  223 + Db::name('Test')->insertGetId(['data'=>$res]);
185 if($res) { 224 if($res) {
186 $this->redirect('http://bifangjia.cn/Compare_Price/pay/PayResult.html'); 225 $this->redirect('http://bifangjia.cn/Compare_Price/pay/PayResult.html');
187 } else { 226 } else {
@@ -21,6 +21,8 @@ class AlipaywapController extends NotifyCommonController @@ -21,6 +21,8 @@ class AlipaywapController extends NotifyCommonController
21 require_once VENDOR_PATH.'alipay_wap/config.php'; 21 require_once VENDOR_PATH.'alipay_wap/config.php';
22 require_once VENDOR_PATH.'alipay_wap/wappay/service/AlipayTradeService.php'; 22 require_once VENDOR_PATH.'alipay_wap/wappay/service/AlipayTradeService.php';
23 require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php'; 23 require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';
  24 + require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeRefundContentBuilder.php';
  25 + require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeFastpayRefundQueryContentBuilder.php';
24 $this->config = $config; 26 $this->config = $config;
25 } 27 }
26 28
@@ -56,6 +58,88 @@ class AlipaywapController extends NotifyCommonController @@ -56,6 +58,88 @@ class AlipaywapController extends NotifyCommonController
56 return $result; 58 return $result;
57 } 59 }
58 60
  61 + // 退款
  62 + public function refund($data) {
  63 +// $data = $this->request->param();
  64 + $config = $this->config;
  65 +
  66 + //商户订单号,商户网站订单系统中唯一订单号
  67 + $out_trade_no = '';
  68 + if(!empty($data['out_trade_no'])) {
  69 + $out_trade_no = trim($data['out_trade_no']);
  70 + }
  71 +
  72 + //支付宝交易号
  73 + if(!empty($data['trade_no'])) {
  74 + $trade_no = trim($data['trade_no']);
  75 + }
  76 + //请二选一设置
  77 +
  78 + //需要退款的金额,该金额不能大于订单金额,必填
  79 + $refund_amount = trim($data['refund_amount']);
  80 +
  81 + //退款的原因说明
  82 + $refund_reason = trim($data['refund_reason']);
  83 +
  84 + //标识一次退款请求,同一笔交易多次退款需要保证唯一,如需部分退款,则此参数必传
  85 +// $out_request_no = trim($data['WIDTRout_request_no']);
  86 + $out_request_no = '';
  87 +
  88 + //构造参数
  89 + $RequestBuilder=new \AlipayTradeRefundContentBuilder();
  90 + $RequestBuilder->setOutTradeNo($out_trade_no);
  91 + $RequestBuilder->setTradeNo($trade_no);
  92 + $RequestBuilder->setRefundAmount($refund_amount);
  93 + $RequestBuilder->setOutRequestNo($out_request_no);
  94 + $RequestBuilder->setRefundReason($refund_reason);
  95 +
  96 + $aop = new \AlipayTradeService($config);
  97 +
  98 + /**
  99 + * alipay.trade.refund (统一收单交易退款接口)
  100 + * @param $builder 业务参数,使用buildmodel中的对象生成。
  101 + * @return $response 支付宝返回的信息
  102 + */
  103 + $response = $aop->Refund($RequestBuilder);
  104 + return $response;
  105 + }
  106 +
  107 + // 退款查询
  108 + public function refundquery($data) {
  109 +
  110 + $config = $this->config;
  111 + //商户订单号,商户网站订单系统中唯一订单号
  112 + $out_trade_no = '';
  113 + if(!empty($data['out_trade_no'])) {
  114 + $out_trade_no = trim($data['out_trade_no']);
  115 + }
  116 +
  117 + //支付宝交易号
  118 + if(!empty($data['trade_no'])) {
  119 + $trade_no = trim($data['trade_no']);
  120 + }
  121 + //请二选一设置
  122 +
  123 + //请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号,必填
  124 + $out_request_no = trim($data['out_request_no']);
  125 +
  126 + //构造参数
  127 + $RequestBuilder=new \AlipayTradeFastpayRefundQueryContentBuilder();
  128 + $RequestBuilder->setOutTradeNo($out_trade_no);
  129 + $RequestBuilder->setTradeNo($trade_no);
  130 + $RequestBuilder->setOutRequestNo($out_request_no);
  131 +
  132 + $aop = new \AlipayTradeService($config);
  133 +
  134 + /**
  135 + * 退款查询 alipay.trade.fastpay.refund.query (统一收单交易退款查询)
  136 + * @param $builder 业务参数,使用buildmodel中的对象生成。
  137 + * @return $response 支付宝返回的信息
  138 + */
  139 + $response = $aop->refundQuery($RequestBuilder);
  140 + return $response;
  141 + }
  142 +
59 // 回调 143 // 回调
60 public function notify_url() { 144 public function notify_url() {
61 $config = $this->config; 145 $config = $this->config;
@@ -82,30 +166,12 @@ class AlipaywapController extends NotifyCommonController @@ -82,30 +166,12 @@ class AlipaywapController extends NotifyCommonController
82 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 166 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
83 //请务必判断请求时的total_amount与通知时获取的total_fee为一致的 167 //请务必判断请求时的total_amount与通知时获取的total_fee为一致的
84 //如果有做过处理,不执行商户的业务程序 168 //如果有做过处理,不执行商户的业务程序
85 -  
86 - $order_model = new OrderModel();  
87 $where['order_sn'] = $out_trade_no; 169 $where['order_sn'] = $out_trade_no;
88 // $where['money'] = $data['total_amount']; 170 // $where['money'] = $data['total_amount'];
89 - $where['money'] = 1;  
90 - $orderInfo = $order_model->where($where)->find();  
91 - if(empty($orderInfo) || $orderInfo['status'] == 9) { 171 + $res = $this->changeOrderStatus($where,$trade_no,3,'pc支付宝支付');
  172 + if(!$res) {
92 echo 'fail';exit; 173 echo 'fail';exit;
93 } 174 }
94 - if($orderInfo['status'] == 1) {  
95 - $info['pay_type'] = 4;  
96 - $info['pay_time'] = time();  
97 - $info['status'] = 2;  
98 - $info['transaction_id'] = $trade_no;  
99 - $order_model->startTrans();  
100 - $results = $order_model->where($where)->update($info);  
101 - if(!$results) {  
102 - $order_model->rollback();  
103 - echo 'fail';exit;  
104 - } else {  
105 - $order_model->commit();  
106 - }  
107 - }  
108 -  
109 //注意: 175 //注意:
110 //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知 176 //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
111 } 177 }
@@ -114,28 +180,12 @@ class AlipaywapController extends NotifyCommonController @@ -114,28 +180,12 @@ class AlipaywapController extends NotifyCommonController
114 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 180 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
115 //请务必判断请求时的total_amount与通知时获取的total_fee为一致的 181 //请务必判断请求时的total_amount与通知时获取的total_fee为一致的
116 //如果有做过处理,不执行商户的业务程序 182 //如果有做过处理,不执行商户的业务程序
117 - $order_model = new OrderModel();  
118 $where['order_sn'] = $out_trade_no; 183 $where['order_sn'] = $out_trade_no;
119 // $where['money'] = $data['total_amount']; 184 // $where['money'] = $data['total_amount'];
120 - $where['money'] = 1;  
121 - $orderInfo = $order_model->where($where)->find();  
122 - if(empty($orderInfo) || $orderInfo['status'] == 9) { 185 + $res = $this->changeOrderStatus($where,$trade_no,3,'pc支付宝支付');
  186 + if(!$res) {
123 echo 'fail';exit; 187 echo 'fail';exit;
124 } 188 }
125 - if($orderInfo['status'] == 1) {  
126 - $info['pay_type'] = 4;  
127 - $info['pay_time'] = time();  
128 - $info['status'] = 2;  
129 - $info['transaction_id'] = $trade_no;  
130 - $order_model->startTrans();  
131 - $results = $order_model->where($where)->update($info);  
132 - if(!$results) {  
133 - $order_model->rollback();  
134 - echo 'fail';exit;  
135 - } else {  
136 - $order_model->commit();  
137 - }  
138 - }  
139 //注意: 189 //注意:
140 //付款完成后,支付宝系统发送该交易状态通知 190 //付款完成后,支付宝系统发送该交易状态通知
141 } 191 }
@@ -154,7 +204,6 @@ class AlipaywapController extends NotifyCommonController @@ -154,7 +204,6 @@ class AlipaywapController extends NotifyCommonController
154 $result = $alipaySevice->check($arr); 204 $result = $alipaySevice->check($arr);
155 // var_dump($_GET); 205 // var_dump($_GET);
156 // echo '<br/>'; 206 // echo '<br/>';
157 -// var_dump($result);exit;  
158 if ($result) { 207 if ($result) {
159 //商户订单号 208 //商户订单号
160 $out_trade_no = htmlspecialchars($_GET['out_trade_no']); 209 $out_trade_no = htmlspecialchars($_GET['out_trade_no']);
@@ -164,30 +213,12 @@ class AlipaywapController extends NotifyCommonController @@ -164,30 +213,12 @@ class AlipaywapController extends NotifyCommonController
164 $data = $_GET; 213 $data = $_GET;
165 $where['order_sn'] = $data['out_trade_no']; 214 $where['order_sn'] = $data['out_trade_no'];
166 // $where['money'] = $data['total_amount']; 215 // $where['money'] = $data['total_amount'];
167 - $where['money'] = 1;  
168 - $order_model = new OrderModel();  
169 - $orderInfo = $order_model->where($where)->find();  
170 - if($orderInfo['status'] == 1) {  
171 - $info['pay_type'] = 4;  
172 - $info['pay_time'] = time();  
173 - $info['status'] = 2;  
174 - $info['transaction_id'] = $data['trade_no'];  
175 - $order_model->startTrans();  
176 - $results = $order_model->where($where)->update($info);  
177 - if(!$results) {  
178 - $order_model->rollback();  
179 - } else {  
180 - $order_model->commit();  
181 - if($orderInfo['type'] == 1) {  
182 - $this->redirect(url('portal/Index/callback'));  
183 - }  
184 - if($orderInfo['type'] == 2) {  
185 - $this->redirect(url('portal/Index/callback'));  
186 - }  
187 - if($orderInfo['type'] == 3) {  
188 - $this->redirect(url('portal/Index/callback'));  
189 - }  
190 - } 216 + $res = $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付');
  217 + Db::name('Test')->insertGetId(['data'=>$res]);
  218 + if($res) {
  219 + $this->redirect('http://bifangjia.cn/Compare_Price/pay/PayResult.html');
  220 + } else {
  221 + $this->redirect('http://bifangjia.cn');
191 } 222 }
192 } 223 }
193 } 224 }
@@ -29,7 +29,7 @@ class CommonController extends HomeBaseController @@ -29,7 +29,7 @@ class CommonController extends HomeBaseController
29 $url = explode('/',$_SERVER['PATH_INFO']); 29 $url = explode('/',$_SERVER['PATH_INFO']);
30 $count_url = count($url); 30 $count_url = count($url);
31 $fun = $url[$count_url-1]; 31 $fun = $url[$count_url-1];
32 - if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' ){ 32 + if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' || $url[1] == 'Index' || $url[1] == 'Thirdsend' ){
33 $connect = 1; 33 $connect = 1;
34 }else{ 34 }else{
35 $connect = 2; 35 $connect = 2;
@@ -94,13 +94,22 @@ class CommonController extends HomeBaseController @@ -94,13 +94,22 @@ class CommonController extends HomeBaseController
94 $response = SmsDemo::sendSms($tel,$code,$modelVal); 94 $response = SmsDemo::sendSms($tel,$code,$modelVal);
95 return $response; 95 return $response;
96 } 96 }
  97 +
  98 + // 中介短信
  99 + public function sendLoginAgency($tel,$code,$modelVal){
  100 + require_once VENDOR_PATH."aliyun-dysms-php-sdk/api_demo/SmsDemo.php";
  101 + set_time_limit(0);
  102 + header('Content-Type: text/plain; charset=utf-8');
  103 + $response = SmsDemo::sendSmsAgency($tel,$modelVal);
  104 + return $response;
  105 + }
  106 +
  107 +
97 // 发送验证码 108 // 发送验证码
98 // $tel 手机号 109 // $tel 手机号
99 // $code 短信模板 110 // $code 短信模板
100 // $type 类型 111 // $type 类型
101 public function SmsResult($tel,$code,$type){ 112 public function SmsResult($tel,$code,$type){
102 -// $tel = $request->param('tel');  
103 -// $code = 'SMS_137416617';  
104 $modelVal = rand(1000,9999); 113 $modelVal = rand(1000,9999);
105 $sendResult = $this->sendLogin($tel,$code,$modelVal); 114 $sendResult = $this->sendLogin($tel,$code,$modelVal);
106 $mes = $sendResult->Message; 115 $mes = $sendResult->Message;
@@ -124,17 +133,17 @@ class CommonController extends HomeBaseController @@ -124,17 +133,17 @@ class CommonController extends HomeBaseController
124 133
125 134
126 // 用户登录 135 // 用户登录
127 - public function isLogin(){  
128 - if($_SESSION['user_id']){  
129 - $where_firstLogin['id'] = $_SESSION['user_id'];  
130 - $firstMember = Db::name('Member')->where($where_firstLogin)->find();  
131 - if($firstMember['update_time'] >= (time()+604800) ){  
132 - $this->apiResponse('0','请先登录');  
133 - }  
134 - }else{  
135 - $this->apiResponse('0','请先登录');  
136 - }  
137 - } 136 +// public function isLogin(){
  137 +// if($_SESSION['user_id']){
  138 +// $where_firstLogin['id'] = $_SESSION['user_id'];
  139 +// $firstMember = Db::name('Member')->where($where_firstLogin)->find();
  140 +// if($firstMember['update_time'] >= (time()+604800) ){
  141 +// $this->apiResponse('0','请先登录');
  142 +// }
  143 +// }else{
  144 +// $this->apiResponse('0','请先登录');
  145 +// }
  146 +// }
138 147
139 // 生成订单随机数 148 // 生成订单随机数
140 public function getmath(){ 149 public function getmath(){
@@ -31,8 +31,6 @@ class IndexController extends CommonController @@ -31,8 +31,6 @@ class IndexController extends CommonController
31 * @url /api/portal/Index/index 31 * @url /api/portal/Index/index
32 * @method POST 32 * @method POST
33 * @param name:chooseType type:int require:1 default: other: desc:类型:1手机站,2PC站 33 * @param name:chooseType type:int require:1 default: other: desc:类型:1手机站,2PC站
34 -  
35 -  
36 */ 34 */
37 35
38 public function index(Request $request) 36 public function index(Request $request)
@@ -135,48 +133,17 @@ class IndexController extends CommonController @@ -135,48 +133,17 @@ class IndexController extends CommonController
135 $this->apiResponse('1','成功',$final); 133 $this->apiResponse('1','成功',$final);
136 } 134 }
137 135
138 -// public function a(){  
139 -// // 推荐人处理  
140 -// if(!empty($getParam['parent_id'])){  
141 -// $where_parentAdd['id'] = $getParam['parent_id'];  
142 -// $where_parentAdd['type'] = 2;  
143 -// $where_reward['type'] = 2;  
144 -// $where_reward['status'] = 1;  
145 -// $reward = Db::name('Reward')->where($where_reward)->order('create_time')->field('number')->find();  
146 -// if($reward){  
147 -// $add_agencyScore = $user->where($where_parentAdd)->setInc('reputation',$reward['number']);  
148 -// if(!$add_agencyScore){  
149 -// $this->apiResponse('0','推荐奖励增加失败');  
150 -// }else{  
151 -//// 推荐记录表  
152 -// $add_log['type'] = 2;  
153 -// $add_log['number'] = $reward['number'];  
154 -// $add_log['referee'] = $getParam['parent_id'];  
155 -// $add_log['recommen'] = $uid;  
156 -// $add_log['create_time'] = time();  
157 -// $add_log['update_time'] = time();  
158 -// $log = Db::name('RewardLog')->insertGetId($add_log);  
159 -// if(!$log){  
160 -// Db::rollback();  
161 -// }  
162 -//// 信誉记录表  
163 -// $add_startlog['detail'] = "推荐".$getParam['parent'].'注册';  
164 -// $add_startlog['star'] = $reward['number'];  
165 -// $add_startlog['type'] = 3;  
166 -// $add_startlog['create_time'] = time();  
167 -// $add_startlog['update_time'] = time();  
168 -// $startLog = Db::name('StartDetail')->insertGetId($add_startlog);  
169 -// if(!$startLog){  
170 -// Db::rollback();  
171 -// }  
172 -// }  
173 -// }else{  
174 -// Db::rollback();  
175 -// $this->apiResponse('0','推荐奖励获取失败');  
176 -// }  
177 -// }  
178 -//// end  
179 -// }  
180 - 136 + /**
  137 + * @title 两分钟视频
  138 + * @description 接口说明
  139 + * @author 开发者
  140 + * @url /api/portal/Index/video
  141 + * @method POST
  142 + */
  143 + public function video(){
  144 + $where_video['status'] = 1;
  145 + $find = Db::name('Video')->where($where_video)->order('create_time desc')->find();
  146 + $this->apiResponse('1','成功',$find);
  147 + }
181 148
182 } 149 }
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 // +---------------------------------------------------------------------- 8 // +----------------------------------------------------------------------
9 namespace api\portal\controller; 9 namespace api\portal\controller;
10 10
  11 +use api\portal\model\OrderModel;
11 use api\portal\model\PortalPostModel; 12 use api\portal\model\PortalPostModel;
12 use cmf\controller\RestBaseController; 13 use cmf\controller\RestBaseController;
13 use api\portal\model\MemberModel; 14 use api\portal\model\MemberModel;
@@ -165,7 +166,10 @@ class IntermediaryController extends CommonController @@ -165,7 +166,10 @@ class IntermediaryController extends CommonController
165 */ 166 */
166 public function myIndex(Request $request){ 167 public function myIndex(Request $request){
167 $token = $request->param('token'); 168 $token = $request->param('token');
  169 + $pageInt = $request->param('page');
168 $member = $this->left($token); 170 $member = $this->left($token);
  171 + $size = 2;
  172 + $all_page = 0;
169 $quarters = explode('+',$member['quarters']); 173 $quarters = explode('+',$member['quarters']);
170 $final['intermediary'] = $member; 174 $final['intermediary'] = $member;
171 $where_need['city'] = $member['city']; 175 $where_need['city'] = $member['city'];
@@ -179,8 +183,9 @@ class IntermediaryController extends CommonController @@ -179,8 +183,9 @@ class IntermediaryController extends CommonController
179 $page = $request->param('page'); 183 $page = $request->param('page');
180 $need_list = Db::name('UserNeed')->where($where_need) 184 $need_list = Db::name('UserNeed')->where($where_need)
181 ->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people,pay_time") 185 ->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people,pay_time")
182 - ->limit(10)->page($page) 186 +// ->limit($size)->page($page)
183 ->select()->toArray(); 187 ->select()->toArray();
  188 +
184 if($need_list){ 189 if($need_list){
185 $else_arr = []; 190 $else_arr = [];
186 foreach ($need_list as $neek=>$neev){ 191 foreach ($need_list as $neek=>$neev){
@@ -191,10 +196,28 @@ class IntermediaryController extends CommonController @@ -191,10 +196,28 @@ class IntermediaryController extends CommonController
191 $else_arr[] = $neev; 196 $else_arr[] = $neev;
192 } 197 }
193 } 198 }
194 - $final['intermediary_need'] = $else_arr; 199 +// $array =array (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25);
  200 + // 分页
  201 + $all_page = count($else_arr);
  202 + $page = ceil($all_page/$size);
  203 +
  204 + if($pageInt <1 || $pageInt >$page ){
  205 + $this->apiResponse('0','页码错误');
  206 + }else{
  207 + $start = $pageInt*$size-$size;
  208 + $end = $pageInt*$size-1;
  209 + foreach ($else_arr as $elsek=>$elsev){
  210 + if($elsek >= $start && $elsek <= $end){
  211 + $res[] = $elsev;
  212 + }
  213 + }
  214 + }
  215 +
  216 + $final['intermediary_need'] = $res;
195 }else{ 217 }else{
196 $final['intermediary_need'] = array(); 218 $final['intermediary_need'] = array();
197 } 219 }
  220 + $final['all_page'] = ceil($all_page/$size);
198 $this->apiResponse('1','成功',$final); 221 $this->apiResponse('1','成功',$final);
199 } 222 }
200 223
@@ -212,22 +235,68 @@ class IntermediaryController extends CommonController @@ -212,22 +235,68 @@ class IntermediaryController extends CommonController
212 $token = $request->param('token'); 235 $token = $request->param('token');
213 $member = $this->left($token); 236 $member = $this->left($token);
214 $final['intermediary'] = $member; 237 $final['intermediary'] = $member;
  238 + $final['money'] = 0;
215 if(!$request->param('need_id')){ 239 if(!$request->param('need_id')){
216 $this->apiResponse('0','请选择需求id'); 240 $this->apiResponse('0','请选择需求id');
  241 + }else{
  242 + $need_id = $request->param('need_id');
217 } 243 }
218 - $where_need['id'] = $request->param('need_id'); 244 + $where_need['id'] = $need_id;
219 $where_need['status'] = 3; 245 $where_need['status'] = 3;
220 $need_list = Db::name('UserNeed')->where($where_need) 246 $need_list = Db::name('UserNeed')->where($where_need)
221 ->field("id,user_id,city,quarters,room,floor,house_type,renovation,area,is_first,loan,contract,quotation_time,create_time,people,else,pay_time") 247 ->field("id,user_id,city,quarters,room,floor,house_type,renovation,area,is_first,loan,contract,quotation_time,create_time,people,else,pay_time")
222 ->find(); 248 ->find();
223 if($need_list){ 249 if($need_list){
  250 +// 判断是否已购买透视卡
  251 + $where_order['type'] = 3;
  252 + $where_order['need_id'] = $need_id;
  253 + $where_order['user_id'] = $member['id'];
  254 + $is_order = Db::name('Order')->where($where_order)->field('id,lower_price')->find();
  255 + if($is_order){
  256 + $final['is_see'] = 2;
  257 + $final['money'] = $is_order['lower_price'];
  258 + $final['pay_time'] = $is_order['pay_time'];
  259 + }else{
  260 + $where_agency['need_id'] = $request->param('need_id');
  261 + $where_agency['status'] = 2;
  262 + $agency_count = Db::name('Agency')->where($where_agency)->count();
  263 + if($agency_count >=3){
  264 + $money = $this->getOrderInfo($token,$need_id);
  265 + $final['is_see'] = 1;
  266 + $final['money'] = $money['money'];
  267 + $final['pay_time'] = $money['pay_time'];
  268 + }else{
  269 + $final['is_see'] = 0;
  270 + }
  271 + }
224 $final['intermediary_need'] = $need_list; 272 $final['intermediary_need'] = $need_list;
  273 +
225 }else{ 274 }else{
226 $final['intermediary_need'] = array(); 275 $final['intermediary_need'] = array();
  276 + $final['is_see'] = 0;
  277 +
227 } 278 }
  279 +
228 $this->apiResponse('1','成功',$final); 280 $this->apiResponse('1','成功',$final);
229 } 281 }
230 282
  283 +
  284 +// * @param name:token type:char require:1 default: other: desc:用户token
  285 +// * @param name:need_id type:int require:1 default: other: desc:需求id
  286 +
  287 + public function getOrderInfo($token,$need_id) {
  288 + $member_model = new MemberModel();
  289 + $user = $member_model->field(['id,money'])->where(['token'=>$token])->find();
  290 + $order_model = new OrderModel();
  291 + $price = $order_model->where(['need_id'=>$need_id,'user_id'=>$user['id'],'type'=>3,'status'=>2])->field('money,pay_time')->find();
  292 + if(empty($price)) {
  293 + return false;
  294 + }
  295 + return $price;
  296 + }
  297 +
  298 +
  299 +
231 // 查询中介报价 300 // 查询中介报价
232 // $need_id 需求id 301 // $need_id 需求id
233 public function agencyOffer($user_id,$need_id){ 302 public function agencyOffer($user_id,$need_id){
@@ -276,48 +345,48 @@ class IntermediaryController extends CommonController @@ -276,48 +345,48 @@ class IntermediaryController extends CommonController
276 // 透视卡 345 // 透视卡
277 //token 346 //token
278 //need_id 347 //need_id
279 - public function see(Request $request){  
280 - $data = $request->param();  
281 - $user = $this->left($data['token']);  
282 - $user_id = $user['id'];  
283 -// 购买支付  
284 -  
285 -  
286 -  
287 -// 成功加入记录  
288 -// 加订单  
289 - $add = array();  
290 - $add['name'] = '购买透视卡';  
291 - $add['order_sn'] = $this->getmath();  
292 - $add['type'] = 3;  
293 - $add['need_id'] = $data['need_id'];  
294 - $add['is_get'] = 2;  
295 -// 查询透视卡金额  
296 - $add['money'] = 2;  
297 -  
298 - $add['status'] = 1;  
299 - $add['create_time'] = time();  
300 - $add['update_time'] = time();  
301 - $order_id = Db::name('Order')->insertGetId($add);  
302 - if(!$order_id){  
303 - $this->apiResponse('0','购买失败');  
304 - }  
305 -  
306 -// 支付成功  
307 -// 修改订单状态  
308 - $where_order['order_sn'] = $data['order_sn'];  
309 - $save['update_time'] = time();  
310 - $save['pay_time'] = time();  
311 - $is_save = Db::name('Order')->where($where_order)->update($save);  
312 - if($is_save){  
313 - return true;  
314 - }else{  
315 - return false;  
316 - }  
317 -// 查询报价  
318 - $money = $this->agencyOffer($user_id,$data['need_id']);  
319 -  
320 - } 348 +// public function see(Request $request){
  349 +// $data = $request->param();
  350 +// $user = $this->left($data['token']);
  351 +// $user_id = $user['id'];
  352 +//// 购买支付
  353 +//
  354 +//
  355 +//
  356 +//// 成功加入记录
  357 +//// 加订单
  358 +// $add = array();
  359 +// $add['name'] = '购买透视卡';
  360 +// $add['order_sn'] = $this->getmath();
  361 +// $add['type'] = 3;
  362 +// $add['need_id'] = $data['need_id'];
  363 +// $add['is_get'] = 2;
  364 +//// 查询透视卡金额
  365 +// $add['money'] = 2;
  366 +//
  367 +// $add['status'] = 1;
  368 +// $add['create_time'] = time();
  369 +// $add['update_time'] = time();
  370 +// $order_id = Db::name('Order')->insertGetId($add);
  371 +// if(!$order_id){
  372 +// $this->apiResponse('0','购买失败');
  373 +// }
  374 +//
  375 +//// 支付成功
  376 +//// 修改订单状态
  377 +// $where_order['order_sn'] = $data['order_sn'];
  378 +// $save['update_time'] = time();
  379 +// $save['pay_time'] = time();
  380 +// $is_save = Db::name('Order')->where($where_order)->update($save);
  381 +// if($is_save){
  382 +// return true;
  383 +// }else{
  384 +// return false;
  385 +// }
  386 +//// 查询报价
  387 +// $money = $this->agencyOffer($user_id,$data['need_id']);
  388 +//
  389 +// }
321 390
322 /** 391 /**
323 * @title 中介个人中心我的报价(sure) 392 * @title 中介个人中心我的报价(sure)
@@ -328,37 +397,43 @@ class IntermediaryController extends CommonController @@ -328,37 +397,43 @@ class IntermediaryController extends CommonController
328 * @param name:token type:int require:1 default: other: desc:token 397 * @param name:token type:int require:1 default: other: desc:token
329 * @param name:page type:int require:1 default: other: desc:页码 398 * @param name:page type:int require:1 default: other: desc:页码
330 */ 399 */
331 - public function myMoney(Request $request){  
332 - $data = $request->param();  
333 - $size = 2;  
334 - $my = $this->left($data['token']);  
335 - $final['intermediary'] = $my;  
336 - $where_need['a.agency_id'] = $my['id'];  
337 - $page = $data['page'];  
338 - $need = Db::name('Agency')->alias('a')  
339 - ->where($where_need)  
340 - ->join("UserNeed n",'n.id = a.need_id')  
341 - ->field("n.city,n.quarters,n.room,n.floor,n.house_type,n.renovation,n.status as need_status,n.create_time as need_time,n.quotation_time, 400 + public function myMoney(Request $request){
  401 + $data = $request->param();
  402 + $size = 2;
  403 + $my = $this->left($data['token']);
  404 + $final['intermediary'] = $my;
  405 + $where_need['a.agency_id'] = $my['id'];
  406 + $page = $data['page'];
  407 + $need = Db::name('Agency')->alias('a')
  408 + ->where($where_need)
  409 + ->join("UserNeed n",'n.id = a.need_id')
  410 + ->field("n.city,n.quarters,n.room,n.floor,n.house_type,n.renovation,n.status as need_status,n.create_time as need_time,n.quotation_time,n.id as need_id,
342 a.all_price,a.create_time,a.status,a.id as intermediaryNeed_id,a.pay_time,a.id ,a.refuse_complaint_time,a.choose_time 411 a.all_price,a.create_time,a.status,a.id as intermediaryNeed_id,a.pay_time,a.id ,a.refuse_complaint_time,a.choose_time
343 ") 412 ")
344 - ->limit($size)->page($page)  
345 - ->select()->toArray();  
346 - if($need){  
347 - $number = Db::name('Agency')->alias('a')  
348 - ->where($where_need)  
349 - ->join("UserNeed n",'n.id = a.need_id')  
350 - ->count();  
351 - $final['all_page'] = ceil($number/$size);  
352 - foreach ($need as $nk=>$nv){  
353 - $changeInt = (int)$nv['all_price'];  
354 - $need[$nk]['intPrice'] = substr($changeInt,0,-4);  
355 - }  
356 - $final['need'] = $need;  
357 - }else{  
358 - $final['need'] = array();  
359 - }  
360 - $this->apiResponse('1','成功',$final);  
361 - } 413 + ->limit($size)->page($page)
  414 + ->select()->toArray();
  415 +
  416 + $all_page = Db::name('Agency')->alias('a')
  417 + ->where($where_need)
  418 + ->join("UserNeed n",'n.id = a.need_id')
  419 + ->count();
  420 + if($need){
  421 + $number = Db::name('Agency')->alias('a')
  422 + ->where($where_need)
  423 + ->join("UserNeed n",'n.id = a.need_id')
  424 + ->count();
  425 + $final['all_page'] = ceil($number/$size);
  426 + foreach ($need as $nk=>$nv){
  427 + $changeInt = (int)$nv['all_price'];
  428 + $need[$nk]['intPrice'] = substr($changeInt,0,-4);
  429 + }
  430 + $final['need'] = $need;
  431 + }else{
  432 + $final['need'] = array();
  433 + }
  434 + $final['all_page'] = ceil($all_page/$size);
  435 + $this->apiResponse('1','成功',$final);
  436 + }
362 437
363 /** 438 /**
364 * @title 中介个人中心我的报价详情(sure) 439 * @title 中介个人中心我的报价详情(sure)
@@ -559,6 +634,110 @@ class IntermediaryController extends CommonController @@ -559,6 +634,110 @@ class IntermediaryController extends CommonController
559 } 634 }
560 } 635 }
561 636
  637 + /**
  638 + * @title 中介确认成交(sure)
  639 + * @description 接口说明
  640 + * @author 开发者
  641 + * @url /api/portal/Intermediary/sure
  642 + * @method POST
  643 + * @param name:token type:int require:1 default: other: desc:token
  644 + * @param name:intermediary_id type:int require:1 default: other: desc:中介报价id
  645 + * @return data:''
  646 + */
  647 + public function sure(Request $request){
  648 + $data = $request->param();
  649 + $where_agency['a.id'] = $data['intermediary_id'];
  650 + $where_agency['a.status'] = 5;
  651 + $agency = Db::name('Agency')->alias('a')
  652 + ->join('Member m','m.id = a.agency_id')
  653 + ->where($where_agency)
  654 + ->field('a.*,m.referee_id,m.name,m.tel')
  655 + ->find();
  656 + if($agency){
  657 + $where_need['id'] = $agency['need_id'];
  658 + $where_need['status'] = 7;
  659 + $need = Db::name('UserNeed')->where($where_need)->find();
  660 + if($need){
  661 + Db::startTrans();
  662 + $update_agency['status'] = 11;
  663 + $update_agency['update_time'] = time();
  664 + $add_agency = Db::name('Agency')->alias('a')->where($where_agency)->update($update_agency);
  665 + $update_need['status'] = 10;
  666 + $update_need['update_time'] = time();
  667 + $add_need = Db::name('UserNeed')->where($where_need)->update($update_need);
  668 + if($add_agency && $add_need){
  669 +// 判断是否已返
  670 + $where_findstatus['token'] = $data['token'];
  671 + $get_money = Db::name('Member')->where($where_findstatus)->value('is_getmoney');
  672 + if($get_money == 0){
  673 + // 增加推荐人返利金额
  674 + if($agency['referee_id']){
  675 + $where_parent['id'] = $agency['referee_id'];
  676 + $parent = Db::name('Member')->where($where_parent)->find();
  677 +// 诚意金金额获取
  678 + $where_reward['type'] = 5;
  679 + $where_reward['status'] = 1;
  680 + $reward = Db::name('Reward')->where($where_reward)->find();
  681 + if($parent){
  682 + $add_detail['user_id'] = $agency['referee_id'];
  683 + $add_detail['user_type'] = $parent['type'];
  684 + $add_detail['title'] = '推荐'.$agency['user_id'];
  685 + $add_detail['money'] = $reward['number'];
  686 + $add_detail['order_type'] = 7;
  687 + $add_detail['type'] = 1;
  688 + $add_detail['status'] = 1;
  689 + $add_detail['create_time'] = time();
  690 + $add_detail['update_time'] = time();
  691 + $add_res = Db::name('MoneyDetail')->insertGetId($add_detail);
  692 + if($add_res){
  693 + $where_addParent['id'] = $agency['referee_id'];
  694 + $add_parent = Db::name('Member')->where($where_addParent)->setInc('money',$reward['number']);
  695 + if(!$add_parent){
  696 + Db::rollback();
  697 + $this->apiResponse('0','确认失败');
  698 + }
  699 + }else{
  700 + Db::rollback();
  701 + $this->apiResponse('0','确认失败');
  702 + }
  703 + }else{
  704 + Db::rollback();
  705 + $this->apiResponse('0','推荐人错误');
  706 + }
  707 + }
  708 + }
  709 +
  710 + // 退回需求用户保证金
  711 + $need['user_type'] = Db::name('Member')->where(['id'=>$need['user_id']])->value('type');
  712 + $thirdsend = controller('Thirdsend','controller');
  713 + $thirdsend->need_order_refund($need,'中介确认成交退款');
  714 +// 给中介发送信息
  715 + $sendResult = $this->sendLoginAgency($agency['tel'],$agency['name']);
  716 + if($sendResult != 'OK'){
  717 + $this->apiResponse('0',$sendResult);
  718 + }
  719 +
  720 + Db::commit();
  721 + $this->apiResponse('1','确认成功');
  722 + }else{
  723 + Db::rollback();
  724 + $this->apiResponse('0','确认失败');
  725 + }
  726 + }else{
  727 + $this->apiResponse('0','需求状态错误');
  728 + }
  729 + }else{
  730 + $this->apiResponse('0','报价状态错误');
  731 + }
  732 +
  733 +
  734 +
  735 +
  736 + }
  737 +
  738 +
  739 +
  740 +
562 741
563 742
564 743
@@ -65,6 +65,7 @@ class IntermediaryneedController extends CommonController @@ -65,6 +65,7 @@ class IntermediaryneedController extends CommonController
65 * @url /api/portal/Intermediaryneed/sendNeed 65 * @url /api/portal/Intermediaryneed/sendNeed
66 * @method POST 66 * @method POST
67 * @param name:token type:int require:1 default: other: desc:token 67 * @param name:token type:int require:1 default: other: desc:token
  68 + * @param name:page type:int require:1 default: other: desc:分页
68 * @return data:''@ 69 * @return data:''@
69 * @data city:'地区' 70 * @data city:'地区'
70 * @data quarters:'小区' 71 * @data quarters:'小区'
@@ -78,6 +79,8 @@ class IntermediaryneedController extends CommonController @@ -78,6 +79,8 @@ class IntermediaryneedController extends CommonController
78 */ 79 */
79 public function sendNeed(Request $request){ 80 public function sendNeed(Request $request){
80 $data = $request->param(); 81 $data = $request->param();
  82 + $page = $data['page'];
  83 + $size = 2;
81 $where_member['token'] = $data['token']; 84 $where_member['token'] = $data['token'];
82 // 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配) 85 // 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配)
83 $member_find = Db::name('Member')->where($where_member)->field("city,quarters")->find(); 86 $member_find = Db::name('Member')->where($where_member)->field("city,quarters")->find();
@@ -94,9 +97,12 @@ class IntermediaryneedController extends CommonController @@ -94,9 +97,12 @@ class IntermediaryneedController extends CommonController
94 } 97 }
95 } 98 }
96 $where_need['quarters'] = array('like',$quarters,'OR'); 99 $where_need['quarters'] = array('like',$quarters,'OR');
97 - $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people")->select()->toArray(); 100 + $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people")->limit($size)->page($page)->select()->toArray();
  101 + $count = Db::name('UserNeed')->where($where_need)->count();
  102 + $final['all_page'] = ceil($count/$size);
  103 + $final['need_list'] = $need_list;
98 if($need_list){ 104 if($need_list){
99 - $this->apiResponse('1','成功',$need_list); 105 + $this->apiResponse('1','成功',$final);
100 }else{ 106 }else{
101 $this->apiResponse('0','该地区暂无匹配需求'); 107 $this->apiResponse('0','该地区暂无匹配需求');
102 } 108 }
@@ -129,6 +135,7 @@ class IntermediaryneedController extends CommonController @@ -129,6 +135,7 @@ class IntermediaryneedController extends CommonController
129 // header('Access-Control-Allow-Origin:*'); 135 // header('Access-Control-Allow-Origin:*');
130 if($request->Post('token') && $request->Post('housing_price')){ 136 if($request->Post('token') && $request->Post('housing_price')){
131 // 判空,处理 137 // 判空,处理
  138 + Db::startTrans();
132 $validate = Loader::validate('IntermediaryNeed'); 139 $validate = Loader::validate('IntermediaryNeed');
133 if(!$validate->scene('offer')->check($_POST)){ 140 if(!$validate->scene('offer')->check($_POST)){
134 return json(array('code'=>0,'msg'=>$validate->getError())); 141 return json(array('code'=>0,'msg'=>$validate->getError()));
@@ -144,6 +151,7 @@ class IntermediaryneedController extends CommonController @@ -144,6 +151,7 @@ class IntermediaryneedController extends CommonController
144 $where_isIsset['agency_id'] = $mem_id['id']; 151 $where_isIsset['agency_id'] = $mem_id['id'];
145 $find_isset = $model->where($where_isIsset)->find(); 152 $find_isset = $model->where($where_isIsset)->find();
146 if($find_isset){ 153 if($find_isset){
  154 + Db::rollback();
147 $this->apiResponse('0','该房屋您已参与报价'); 155 $this->apiResponse('0','该房屋您已参与报价');
148 } 156 }
149 // 判断是否存在 157 // 判断是否存在
@@ -151,6 +159,7 @@ class IntermediaryneedController extends CommonController @@ -151,6 +159,7 @@ class IntermediaryneedController extends CommonController
151 $where_issetNeed['status'] = 3; 159 $where_issetNeed['status'] = 3;
152 $issetNeed = Db::name('UserNeed')->where($where_issetNeed)->find(); 160 $issetNeed = Db::name('UserNeed')->where($where_issetNeed)->find();
153 if(!$issetNeed){ 161 if(!$issetNeed){
  162 + Db::rollback();
154 $this->apiResponse('0','需求错误'); 163 $this->apiResponse('0','需求错误');
155 } 164 }
156 $data['all_price'] = $data['housing_price']*10000 + $data['assessment_tax'] + $data['value_added_tax'] + $data['security_tax'] + $data['deed_tax'] + $data['else_tax'] + $data['personal_income_tax'] + $data['service_charge']; 165 $data['all_price'] = $data['housing_price']*10000 + $data['assessment_tax'] + $data['value_added_tax'] + $data['security_tax'] + $data['deed_tax'] + $data['else_tax'] + $data['personal_income_tax'] + $data['service_charge'];
@@ -160,6 +169,7 @@ class IntermediaryneedController extends CommonController @@ -160,6 +169,7 @@ class IntermediaryneedController extends CommonController
160 $where_inteRule['height'] = array('egt',$data['housing_price']); 169 $where_inteRule['height'] = array('egt',$data['housing_price']);
161 $inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find(); 170 $inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find();
162 if(!$inte_money){ 171 if(!$inte_money){
  172 + Db::rollback();
163 $this->apiResponse('0','保证金获取失败'); 173 $this->apiResponse('0','保证金获取失败');
164 }else{ 174 }else{
165 $data['deposit'] = $inte_money['money']; 175 $data['deposit'] = $inte_money['money'];
@@ -170,8 +180,17 @@ class IntermediaryneedController extends CommonController @@ -170,8 +180,17 @@ class IntermediaryneedController extends CommonController
170 $final['intermediaryNeed_id'] = $model->getLastInsID(); 180 $final['intermediaryNeed_id'] = $model->getLastInsID();
171 181
172 if($save){ 182 if($save){
173 - $this->apiResponse('1','添加成功',$final); 183 + $where_addCount['token'] = $data['token'];
  184 + $add_count = Db::name('member')->where($where_addCount)->setInc('count_agency',1);
  185 + if($add_count){
  186 + Db::rollback();
  187 + }else{
  188 + Db::commit();
  189 + $this->apiResponse('1','添加成功',$final);
  190 + }
  191 +
174 }else{ 192 }else{
  193 + Db::rollback();
175 $this->apiResponse('0','添加失败'); 194 $this->apiResponse('0','添加失败');
176 } 195 }
177 }else{ 196 }else{
@@ -38,7 +38,6 @@ class NotifyCommonController extends HomeBaseController @@ -38,7 +38,6 @@ class NotifyCommonController extends HomeBaseController
38 'pay_time' => time(), 38 'pay_time' => time(),
39 'transaction_id'=>$transaction_id 39 'transaction_id'=>$transaction_id
40 ]; 40 ];
41 - Db::name('Test')->insertGetId(['data'=>0]);  
42 // 根据支付类型修改不同表的数据 41 // 根据支付类型修改不同表的数据
43 if($orderInfo['type'] == 1) { 42 if($orderInfo['type'] == 1) {
44 $user_need_model = new UserNeedModel(); 43 $user_need_model = new UserNeedModel();
@@ -59,14 +58,14 @@ class NotifyCommonController extends HomeBaseController @@ -59,14 +58,14 @@ class NotifyCommonController extends HomeBaseController
59 } 58 }
60 if(!$pay || !$status) { 59 if(!$pay || !$status) {
61 $order_model->rollback(); 60 $order_model->rollback();
62 - return false; 61 + return 0;
63 } 62 }
64 // 记录用户金额记录 63 // 记录用户金额记录
65 $member_model = new MemberModel(); 64 $member_model = new MemberModel();
66 - $user = $member_model->field(['id,type'])->where(['id'=>$orderInfo['user_id']])->find(); 65 + $user = $member_model->field(['id,type,referee_id'])->where(['id'=>$orderInfo['user_id']])->find();
67 if(!$user) { 66 if(!$user) {
68 $order_model->rollback(); 67 $order_model->rollback();
69 - return false; 68 + return 0;
70 } 69 }
71 $money_detail_model = new MoneyDetailModel(); 70 $money_detail_model = new MoneyDetailModel();
72 if($orderInfo['type'] == 1) { 71 if($orderInfo['type'] == 1) {
@@ -87,43 +86,47 @@ class NotifyCommonController extends HomeBaseController @@ -87,43 +86,47 @@ class NotifyCommonController extends HomeBaseController
87 'order_type' => $order_type, 86 'order_type' => $order_type,
88 'type' => 2, 87 'type' => 2,
89 'pay_type' => $pay_type, 88 'pay_type' => $pay_type,
90 - 'create_time' => time() 89 + 'create_time' => time(),
  90 + 'update_time' => time()
91 ]; 91 ];
92 $money_detail_insert = $money_detail_model->insertGetId($insert); 92 $money_detail_insert = $money_detail_model->insertGetId($insert);
93 if(!$money_detail_insert) { 93 if(!$money_detail_insert) {
94 $order_model->rollback(); 94 $order_model->rollback();
95 - return false; 95 + return 0;
96 } 96 }
97 // 增加用户推荐人余额 97 // 增加用户推荐人余额
98 - if($user['referee_id'] && ($orderInfo['type'] == 1 || $orderInfo['type'] == 2)) {  
99 - $referee_user = $member_model->where(['id'=>$user['referee_id']])->find();  
100 - if($referee_user) {  
101 - $reward_model = new RewardModel();  
102 - $reward_number = $reward_model->where(['type'=>5,'status'=>['neq',9]])->value('number');  
103 - $referee_result = $member_model->where(['id'=>$user['referee_id']])->setInc('money',$reward_number);  
104 - if(!$referee_result) {  
105 - $order_model->rollback();  
106 - return false;  
107 - }  
108 - $insert = [  
109 - 'user_id' => $user['id'],  
110 - 'user_type' => $user['type'],  
111 - 'title' => '推荐人奖励',  
112 - 'money' => $reward_number,  
113 - 'order_type' => 7,  
114 - 'type' => 1,  
115 - 'pay_type' => 3,  
116 - 'create_time' => time()  
117 - ];  
118 - $money_detail_insert2 = $money_detail_model->insertGetId($insert);  
119 - if(!$money_detail_insert2) {  
120 - $order_model->rollback();  
121 - return false;  
122 - }  
123 - }  
124 - } 98 +// if(!empty($user['referee_id']) && ($orderInfo['type'] == 1 || $orderInfo['type'] == 2)) {
  99 +//// $referee_user = $member_model->where(['id'=>$user['referee_id']])->find();
  100 +////// Db::name('Test')->insertGetId(['data'=>json_encode($referee_user)]);
  101 +//// if(!empty($referee_user)) {
  102 +//// $reward_model = new RewardModel();
  103 +//// $reward_number = $reward_model->where(['type'=>5,'status'=>['neq',9]])->value('number');
  104 +//// $referee_result = $member_model->where(['id'=>$user['referee_id']])->setInc('money',$reward_number);
  105 +//// if(!$referee_result) {
  106 +//// $order_model->rollback();
  107 +//// return 0;
  108 +//// }
  109 +//// $insert = [
  110 +//// 'order_id' => $orderInfo['id'],
  111 +//// 'user_id' => $user['id'],
  112 +//// 'user_type' => $user['type'],
  113 +//// 'title' => '推荐人奖励',
  114 +//// 'money' => $reward_number,
  115 +//// 'order_type' => 7,
  116 +//// 'type' => 1,
  117 +//// 'pay_type' => 3,
  118 +//// 'create_time' => time(),
  119 +//// 'update_time' => time()
  120 +//// ];
  121 +//// $money_detail_insert2 = $money_detail_model->insertGetId($insert);
  122 +//// if(!$money_detail_insert2) {
  123 +//// $order_model->rollback();
  124 +//// return 0;
  125 +//// }
  126 +//// }
  127 +//// }
125 $order_model->commit(); 128 $order_model->commit();
126 - return true; 129 + return 1;
127 } 130 }
128 } 131 }
129 132
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 namespace api\portal\controller; 9 namespace api\portal\controller;
10 10
11 use api\portal\controller\NotifyCommonController; 11 use api\portal\controller\NotifyCommonController;
  12 +use think\Config;
  13 +use think\Db;
12 14
13 class NotifyController extends NotifyCommonController 15 class NotifyController extends NotifyCommonController
14 { 16 {
@@ -33,11 +35,17 @@ class NotifyController extends NotifyCommonController @@ -33,11 +35,17 @@ class NotifyController extends NotifyCommonController
33 if($base->CheckSign() == true){ 35 if($base->CheckSign() == true){
34 if ($data["return_code"] == "SUCCESS") { 36 if ($data["return_code"] == "SUCCESS") {
35 $where['order_sn'] = $data['attach']; 37 $where['order_sn'] = $data['attach'];
36 - if (!$where['order_sn']) { 38 + if (empty($where['order_sn'])) {
37 $where['order_sn'] = $data['out_trade_no']; 39 $where['order_sn'] = $data['out_trade_no'];
38 } 40 }
39 // $where['money'] = $data['total_fee']/100; 41 // $where['money'] = $data['total_fee']/100;
40 - $result = $this->changeOrderStatus($where,$data['transaction_id'],1,'pc微信扫码支付'); 42 + $pay_type = 1;
  43 + $title = 'pc微信扫码支付';
  44 + if($data["trade_type"] == 'MWEB') {
  45 + $pay_type = 2;
  46 + $title = '网页H5支付';
  47 + }
  48 + $result = $this->changeOrderStatus($where,$data['transaction_id'],$pay_type,$title);
41 if($result) { 49 if($result) {
42 $this->return_success(); 50 $this->return_success();
43 } 51 }
@@ -46,6 +54,132 @@ class NotifyController extends NotifyCommonController @@ -46,6 +54,132 @@ class NotifyController extends NotifyCommonController
46 } 54 }
47 } 55 }
48 56
  57 + /**
  58 + * 微信支付退款结果回调
  59 + */
  60 + public function refund_notify() {
  61 + $post = $this->request->param();
  62 + if($post==null){
  63 + $post = file_get_contents("php://input");
  64 + if($post == null){
  65 + $post = $GLOBALS['HTTP_RAW_POST_DATA'];
  66 + }
  67 + }
  68 + if(!empty($post)) {
  69 + $xml = $post; //微信的回调数据
  70 + $data = $this->xmlToArray($xml);
  71 + if($data['return_code'] == 'SUCCESS' && !empty($data['req_info'])) {
  72 + $key = md5(Config::get('wx_key'));
  73 + $array = $this->xmlToArray($this->refund_decrypt($data['req_info'],$key));
  74 + $refund_where = [
  75 + 'order_sn' => $array['out_refund_no'],
  76 + 'refund_id' => $array['refund_id'],
  77 + ];
  78 + $order_where = [
  79 + 'transaction_id' => $array['transaction_id'],
  80 + ];
  81 + $handle_sql = true;
  82 + Db::startTrans();
  83 + if($array['refund_status'] == 'SUCCESS') {
  84 + $refundInfo = Db::name('Refund')->where($refund_where)->find();
  85 + $refund_update = [
  86 + 'status' => 2,
  87 + 'refund_time' => strtotime($array['success_time']),
  88 + 'remark' => $array['refund_account'],
  89 + 'more' => json_encode($array),
  90 + ];
  91 + $refund_result = Db::name('Refund')->where($refund_where)->update($refund_update);
  92 + $order_update = [
  93 + 'status' => 4,
  94 + 'refund_time' => strtotime($array['success_time'])
  95 + ];
  96 + $order_result = Db::name('Order')->where($order_where)->update($order_update);
  97 + $order_type = '';
  98 + if($refundInfo['user_type'] == 1) {
  99 + $order_type = 4;
  100 + }if($refundInfo['user_type'] == 2) {
  101 + $order_type = 5;
  102 + }
  103 + $insert = [
  104 + 'order_id' => $refundInfo['order_id'],
  105 + 'user_id' => $refundInfo['user_id'],
  106 + 'user_type' => $refundInfo['user_type'],
  107 + 'title' => '退款',
  108 + 'order_type' => $order_type,
  109 + 'type' => 1,
  110 + 'reason' => $refundInfo['reason'],
  111 + 'create_time' => time(),
  112 + 'update_time' => time()
  113 + ];
  114 + $money_detail_insert = Db::name('MoneyDetail')->insertGetId($insert);
  115 + if(!$refund_result || !$order_result || !$money_detail_insert) {
  116 + $handle_sql = false;
  117 + }
  118 + } elseif($array['refund_status'] == 'CHANGE') {
  119 + $refund_update = [
  120 + 'status' => 4,
  121 +// 'refund_time' => strtotime($array['success_time']),
  122 +// 'remark' => $array['refund_account'],
  123 + 'more' => json_encode($array),
  124 + ];
  125 + $refund_result = Db::name('Refund')->where($refund_where)->update($refund_update);
  126 + if(!$refund_result) {
  127 + $handle_sql = false;
  128 + }
  129 + } elseif($array['refund_status'] == 'REFUNDCLOSE') {
  130 + $refund_update = [
  131 + 'status' => 3,
  132 +// 'refund_time' => strtotime($array['success_time']),
  133 +// 'remark' => $array['refund_account'],
  134 + 'more' => json_encode($array),
  135 + ];
  136 + $refund_result = Db::name('Refund')->where($refund_where)->update($refund_update);
  137 + if(!$refund_result) {
  138 + $handle_sql = false;
  139 + }
  140 + }
  141 + if(!$handle_sql) {
  142 + Db::rollback();
  143 + } else {
  144 + Db::commit();
  145 + $this->return_success();
  146 + }
  147 + }
  148 + }
  149 + }
  150 +
  151 + /**
  152 + * 微信退款回调数据
  153 + * (1)对加密串A做base64解码,得到加密串B
  154 + * (2)对商户key做md5,得到32位小写key* ( key设置路径:微信商户平台(pay.weixin.qq.com)-->账户设置-->API安全-->密钥设置 )
  155 + * (3)用key*对加密串B做AES-256-ECB解密(PKCS7Padding)
  156 + */
  157 +
  158 + private function refund_decrypt($str, $key) {
  159 + $str = base64_decode($str);
  160 + $decrypted = openssl_decrypt($str, 'AES-256-ECB', $key, OPENSSL_RAW_DATA);
  161 + return $decrypted;
  162 + }
  163 +
  164 + //xml转换成数组
  165 + private function xmlToArray($xml) {
  166 +
  167 +
  168 + //禁止引用外部xml实体
  169 +
  170 +
  171 + libxml_disable_entity_loader(true);
  172 +
  173 +
  174 + $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
  175 +
  176 +
  177 + $val = json_decode(json_encode($xmlstring), true);
  178 +
  179 +
  180 + return $val;
  181 + }
  182 +
49 /* 183 /*
50 * 给微信发送确认订单金额和签名正确,SUCCESS信息 184 * 给微信发送确认订单金额和签名正确,SUCCESS信息
51 */ 185 */
@@ -51,7 +51,7 @@ class OrderController extends CommonController @@ -51,7 +51,7 @@ class OrderController extends CommonController
51 $money = $info['pay_money']; 51 $money = $info['pay_money'];
52 } 52 }
53 if($data['_type'] == 2) { 53 if($data['_type'] == 2) {
54 - $info = $agency_model->where(['id'=>$data['need_id'],'agency_id'=>$user_id])->find(); 54 + $info = $agency_model->where(['need_id'=>$data['need_id'],'agency_id'=>$user_id])->find();
55 $need = $user_need_model->where(['id'=>$info['need_id']])->find(); 55 $need = $user_need_model->where(['id'=>$info['need_id']])->find();
56 if($need['status'] != 3) { 56 if($need['status'] != 3) {
57 $this->apiResponse(0,'该需求当前状态无法进行报价'); 57 $this->apiResponse(0,'该需求当前状态无法进行报价');
@@ -124,7 +124,7 @@ class OrderController extends CommonController @@ -124,7 +124,7 @@ class OrderController extends CommonController
124 } 124 }
125 if($orderInfo['type'] == 2) { 125 if($orderInfo['type'] == 2) {
126 $info = $agency_model->where(['id'=>$orderInfo['need_id'],'agency_id'=>$user['id']])->find(); 126 $info = $agency_model->where(['id'=>$orderInfo['need_id'],'agency_id'=>$user['id']])->find();
127 - $need = $user_need_model->where(['id'=>$info['need_id'],'user_id'=>$user['id']])->find(); 127 + $need = $user_need_model->where(['id'=>$info['need_id']])->find();
128 if($need['status'] != 3) { 128 if($need['status'] != 3) {
129 $this->apiResponse(0,'该需求当前状态无法进行报价'); 129 $this->apiResponse(0,'该需求当前状态无法进行报价');
130 } 130 }
@@ -137,49 +137,41 @@ class OrderController extends CommonController @@ -137,49 +137,41 @@ class OrderController extends CommonController
137 if(($orderInfo['type'] == 1 && $info['status'] == 1) || 137 if(($orderInfo['type'] == 1 && $info['status'] == 1) ||
138 ($orderInfo['type'] == 3 && $info['status'] == 3) || 138 ($orderInfo['type'] == 3 && $info['status'] == 3) ||
139 ($orderInfo['type'] == 2 && $info['status'] == 1)) { 139 ($orderInfo['type'] == 2 && $info['status'] == 1)) {
140 -// if($data['_type'] == 5) {  
141 -// if($user['money'] < $orderInfo['money']) {  
142 -// $this->apiResponse(0,'余额不足');  
143 -// } else {  
144 -// $order_model->startTrans();  
145 -// $where = [  
146 -// 'order_sn' => $data['order_sn']  
147 -// ];  
148 -// $update = [  
149 -// 'status' => 2,  
150 -// 'pay_type' => 5,  
151 -// 'pay_time' => time()  
152 -// ];  
153 -// if($orderInfo['type'] == 1) {  
154 -// $pay = $order_model->where($where)->update($update);  
155 -// $status = $user_need_model->where()->update(['status'=>2,'pay_time'=>time()]);  
156 -// }  
157 -// if($orderInfo['type'] == 2) {  
158 -// $pay = $order_model->where($where)->update($update);  
159 -// $status = $agency_model->where()->update(['status'=>2,'pay_time'=>time()]);  
160 -// }  
161 -// if($orderInfo['type'] == 3) {  
162 -// $Intermediary = controller('Intermediary','controller');  
163 -// $agencyOffer = $Intermediary->agencyOffer($user['id'],$info['id']);  
164 -// $update['lower_price'] = $agencyOffer['money'];  
165 -// $pay = $order_model->where($where)->update($update);  
166 -// $status = 1;  
167 -// }  
168 -// if(!$pay || !$status) {  
169 -// $order_model->rollback();  
170 -// $this->apiResponse(0,'支付失败');  
171 -// }  
172 -// $order_model->commit();  
173 -// $this->apiResponse(5,'支付成功');  
174 -// }  
175 -// }  
176 if($data['_type'] == 1) { 140 if($data['_type'] == 1) {
177 $return = $this->wxpay(['order_sn'=>$data['order_sn']],$sort); 141 $return = $this->wxpay(['order_sn'=>$data['order_sn']],$sort);
178 - $qrcode_url = url('portal/Qrcode/qrcode',['data'=>urlencode($return['code_url'])],true,true); 142 + if(empty($return['code_url'])) {
  143 + $this->apiResponse(0,$return['return_msg']);
  144 + } else {
  145 + $code_url = $return['code_url'];
  146 + }
  147 + $qrcode_url = url('portal/Qrcode/qrcode',['data'=>urlencode($code_url)],true,true);
179 $this->apiResponse(1,'微信支付',['type'=>1,'url'=>$qrcode_url]); 148 $this->apiResponse(1,'微信支付',['type'=>1,'url'=>$qrcode_url]);
  149 + } elseif($data['_type'] == 2) {
  150 + $type = [
  151 + 1 => '保证金支付',
  152 + 2 => '中介报价',
  153 + 3 => '透视卡'
  154 + ];
  155 + require_once VENDOR_PATH.'WxpayAPI/WxpayH5.php';
  156 + $scene_info = "{'h5_info': {'type':'Wap','wap_url': 'http://houseprice.w.bronet.cn','wap_name': ".$sort."}}";
  157 + $h5 = new \WxpayH5(config('wx_appid'),config('wx_mch_id'),config('wx_key'),$data['order_sn'],
  158 + $type[$orderInfo['type']],'1',$scene_info);
  159 + $result = $h5->pay();
  160 + if(empty($result['mweb_url'])) {
  161 + $this->apiResponse(0,'生成支付失败');
  162 + }
  163 +// $return = [
  164 +// 'mwen_url' => $result['mweb_url'],
  165 +// 'create_time' => time(),
  166 +// 'over_time'=>time()+5*60
  167 +// ];
  168 + $this->apiResponse(1,'微信H5支付',['type'=>2,'url'=>$result['mweb_url']]);
180 } elseif($data['_type'] == 3) { 169 } elseif($data['_type'] == 3) {
181 $alipay_url = url('portal/Alipay/alipay',['order_sn'=>$data['order_sn'],'name'=>$sort,'price'=>0.01],true,true); 170 $alipay_url = url('portal/Alipay/alipay',['order_sn'=>$data['order_sn'],'name'=>$sort,'price'=>0.01],true,true);
182 $this->apiResponse(1,'支付宝支付',['type'=>3,'url'=>$alipay_url]); 171 $this->apiResponse(1,'支付宝支付',['type'=>3,'url'=>$alipay_url]);
  172 + } elseif($data['_type'] == 4) {
  173 + $alipay_url = url('portal/Alipaywap/alipay',['order_sn'=>$data['order_sn'],'name'=>$sort,'price'=>0.01],true,true);
  174 + $this->apiResponse(1,'支付宝手机支付',['type'=>4,'url'=>$alipay_url]);
183 } 175 }
184 } else { 176 } else {
185 $this->apiResponse(0,'该订单已失效'); 177 $this->apiResponse(0,'该订单已失效');
@@ -286,4 +278,27 @@ class OrderController extends CommonController @@ -286,4 +278,27 @@ class OrderController extends CommonController
286 $this->apiResponse(1,'成功', $name); 278 $this->apiResponse(1,'成功', $name);
287 } 279 }
288 } 280 }
  281 +
  282 + /**
  283 + * @title 根据订单号查询订单信息(购买透视卡查询到的最低价)
  284 + * @description 接口说明
  285 + * @author 开发者
  286 + * @url /api/portal/Order/getOrderInfo
  287 + * @method POST
  288 + * @param name:token type:char require:1 default: other: desc:用户token
  289 + * @param name:need_id type:int require:1 default: other: desc:需求ID
  290 + *
  291 + */
  292 + public function getOrderInfo($token,$need_id) {
  293 +// if($this->request->isPost()) {
  294 + $member_model = new MemberModel();
  295 + $user = $member_model->field(['id,money'])->where(['token'=>$token])->find();
  296 + $order_model = new OrderModel();
  297 + $array = $order_model->field('pay_time,lower_price')->where(['need_id'=>$need_id,'user_id'=>$user['id'],'type'=>3,'status'=>2])->find();
  298 + if(empty($array)) {
  299 + return false;
  300 + }
  301 + return $array;
  302 +// }
  303 + }
289 } 304 }
@@ -11,6 +11,7 @@ namespace api\portal\controller; @@ -11,6 +11,7 @@ namespace api\portal\controller;
11 11
12 use api\portal\model\AgencyModel; 12 use api\portal\model\AgencyModel;
13 use api\portal\model\OrderModel; 13 use api\portal\model\OrderModel;
  14 +use api\portal\model\RefundModel;
14 use api\portal\model\UserNeedModel; 15 use api\portal\model\UserNeedModel;
15 use cmf\controller\HomeBaseController; 16 use cmf\controller\HomeBaseController;
16 use api\portal\model\PortalPostModel; 17 use api\portal\model\PortalPostModel;
@@ -181,6 +182,7 @@ class ThirdsendController extends HomeBaseController @@ -181,6 +182,7 @@ class ThirdsendController extends HomeBaseController
181 if(!$userNeedList){ 182 if(!$userNeedList){
182 $this->apiResponse('0','需求状态不正确'); 183 $this->apiResponse('0','需求状态不正确');
183 } 184 }
  185 + $userNeedList['user_type'] = Db::name('Member')->where(['id'=>$userNeedList['user_id']])->value('type');
184 $time = time(); 186 $time = time();
185 // 查询相应报价 187 // 查询相应报价
186 $final_time = $userNeedList['pay_time'] + $userNeedList['quotation_time'] * 86400; 188 $final_time = $userNeedList['pay_time'] + $userNeedList['quotation_time'] * 86400;
@@ -195,24 +197,23 @@ class ThirdsendController extends HomeBaseController @@ -195,24 +197,23 @@ class ThirdsendController extends HomeBaseController
195 $agency_list = Db::name('Agency')->alias('a') 197 $agency_list = Db::name('Agency')->alias('a')
196 ->where($where_agency) 198 ->where($where_agency)
197 ->join("hp_Member m", 'm.id = a.agency_id') 199 ->join("hp_Member m", 'm.id = a.agency_id')
198 - ->field('a.*,m.company') 200 + ->field('a.*,m.company,m.type as user_type')
199 ->select()->toArray(); 201 ->select()->toArray();
200 // 查询品牌企业 202 // 查询品牌企业
201 $where_brand['status'] = 1; 203 $where_brand['status'] = 1;
202 $band_list = Db::name('Brand')->where($where_brand)->column('name'); 204 $band_list = Db::name('Brand')->where($where_brand)->column('name');
203 - $agen_arr = array(); 205 + $agen_arr = $is_trueMoney = array();
204 if ($agency_list) { 206 if ($agency_list) {
  207 + $get_list = array();
205 // 删除十万以内报价 208 // 删除十万以内报价
206 foreach ($agency_list as $tenk=>$tenv){ 209 foreach ($agency_list as $tenk=>$tenv){
207 $ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge']; 210 $ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge'];
208 - if($ten_money > 1000000){ 211 + if($ten_money > 100000){
209 $is_trueMoney[] = $tenv; 212 $is_trueMoney[] = $tenv;
210 } 213 }
211 } 214 }
212 // 判断是否超过三个报价人 215 // 判断是否超过三个报价人
213 if (count($is_trueMoney) >= 3) { 216 if (count($is_trueMoney) >= 3) {
214 -  
215 -  
216 // 查询三人中是否有品牌中介 217 // 查询三人中是否有品牌中介
217 // 循环匹配品牌企业 218 // 循环匹配品牌企业
218 foreach ($is_trueMoney as $agencyk => $agencyv) { 219 foreach ($is_trueMoney as $agencyk => $agencyv) {
@@ -257,6 +258,8 @@ class ThirdsendController extends HomeBaseController @@ -257,6 +258,8 @@ class ThirdsendController extends HomeBaseController
257 }else{ 258 }else{
258 $get_list = $fin_arr; 259 $get_list = $fin_arr;
259 } 260 }
  261 + }else{
  262 + $get_list = $fin_arr;
260 } 263 }
261 foreach ($else_changeList as $getk=>$getv){ 264 foreach ($else_changeList as $getk=>$getv){
262 if(in_array($getv,$get_list)){ 265 if(in_array($getv,$get_list)){
@@ -266,7 +269,12 @@ class ThirdsendController extends HomeBaseController @@ -266,7 +269,12 @@ class ThirdsendController extends HomeBaseController
266 $change_final['id'] = $getv; 269 $change_final['id'] = $getv;
267 $change_final['status'] = 3; 270 $change_final['status'] = 3;
268 // 中介报价未进入决赛,执行订单退款 271 // 中介报价未进入决赛,执行订单退款
269 - $refund_result = $this->agency_order_refund($getv,'中介报价未进入决赛圈退款'); 272 + $agencyInfo = Db::name('Agency')->alias('a')
  273 + ->where(['a.id'=>$getv])
  274 + ->join("hp_Member m", 'm.id = a.agency_id')
  275 + ->field('a.*,m.company,m.type as user_type')
  276 + ->find();
  277 + $refund_result = $this->agency_order_refund($agencyInfo,'中介报价未进入决赛圈退款',2);
270 } 278 }
271 $agencyModel = new AgencyModel(); 279 $agencyModel = new AgencyModel();
272 $fianl_AgsaveFirst = $agencyModel->isUpdate(true)->save($change_final); 280 $fianl_AgsaveFirst = $agencyModel->isUpdate(true)->save($change_final);
@@ -275,7 +283,7 @@ class ThirdsendController extends HomeBaseController @@ -275,7 +283,7 @@ class ThirdsendController extends HomeBaseController
275 } 283 }
276 } 284 }
277 // 报价成功,更改状态 285 // 报价成功,更改状态
278 - $userSave_statusFirst['id'] = $userNeedList['need_id']; 286 + $userSave_statusFirst['id'] = $userNeedList['id'];
279 $userSave_statusFirst['status'] = 5; 287 $userSave_statusFirst['status'] = 5;
280 $userSave_statusFirst['choose_time'] = time(); 288 $userSave_statusFirst['choose_time'] = time();
281 $userNeedModel = new UserNeedModel(); 289 $userNeedModel = new UserNeedModel();
@@ -295,28 +303,7 @@ class ThirdsendController extends HomeBaseController @@ -295,28 +303,7 @@ class ThirdsendController extends HomeBaseController
295 Db::rollback(); 303 Db::rollback();
296 } 304 }
297 // 中介报价订单退款 305 // 中介报价订单退款
298 - $refund_result = $this->agency_order_refund($changeva,'中介报价少于3人退款');  
299 -  
300 -// 退回中介保证金  
301 -// $add_a['user_id'] = $changeva['agency_id'];  
302 -// $add_a['title'] = '报价人数不足';  
303 -// $add_a['type'] = 1;  
304 -// $add_a['reason'] = 1;  
305 -// $add_a['money'] = $changeva['deposit'];  
306 -// $add_a['create_time'] = time();  
307 -// $add_a['update_time'] = time();  
308 -// $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);  
309 -// if (!$amoney_id) {  
310 -// Db::rollback();  
311 -// }  
312 -// 用户表增加金额  
313 - $where_member['type'] = 2;  
314 - $where_member['id'] = $changeva['agency_id'];  
315 - $add_money = Db::name('Member')->where($where_member)->setInc('money',$changeva['deposit']);  
316 - if (!$add_money) {  
317 - Db::rollback();  
318 - }  
319 - 306 + $refund_result = $this->agency_order_refund($changeva,'中介报价少于3人退款',1);
320 } 307 }
321 $userSave_status['id'] = $userNeedList['id']; 308 $userSave_status['id'] = $userNeedList['id'];
322 $userSave_status['status'] = 4; 309 $userSave_status['status'] = 4;
@@ -327,29 +314,7 @@ class ThirdsendController extends HomeBaseController @@ -327,29 +314,7 @@ class ThirdsendController extends HomeBaseController
327 } 314 }
328 315
329 // 用户需求订单退款 316 // 用户需求订单退款
330 - $refund_result = $this->need_order_refund($userNeedList,'报价人数不足');  
331 -  
332 -// 退回保证金  
333 -// 用户  
334 -// 加用户金额明细表  
335 -// $add_del['need_id'] = $userNeedList['id'];  
336 -// $add_del['user_id'] = $userNeedList['user_id'];  
337 -// $add_del['title'] = '报价人数不足';  
338 -// $add_del['reason'] = 1;  
339 -// $add_del['type'] = 1;  
340 -// $add_del['money'] = $userNeedList['pay_money'];  
341 -// $add_del['create_time'] = time();  
342 -// $add_del['update_time'] = time();  
343 -// $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);  
344 -// if (!$umoney_id) {  
345 -// Db::rollback();  
346 -// }  
347 - $where_memberNext['type'] = 1;  
348 - $where_memberNext['id'] = $userNeedList['user_id'];  
349 - $add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);  
350 - if (!$add_moneyNext) {  
351 - Db::rollback();  
352 - } 317 + $refund_result = $this->need_order_refund($userNeedList,'报价人数不足',1);
353 } 318 }
354 } else { 319 } else {
355 // 没有报价 320 // 没有报价
@@ -361,30 +326,7 @@ class ThirdsendController extends HomeBaseController @@ -361,30 +326,7 @@ class ThirdsendController extends HomeBaseController
361 Db::rollback(); 326 Db::rollback();
362 } 327 }
363 // 用户需求订单退款 328 // 用户需求订单退款
364 - $refund_result = $this->need_order_refund($userNeedList,'报价人数不足');  
365 -  
366 -// 退回保证金  
367 -// 用户  
368 -// 加用户金额明细表  
369 -// $add_del['need_id'] = $userNeedList['id'];  
370 -// $add_del['user_id'] = $userNeedList['user_id'];  
371 -// $add_del['title'] = '报价人数不足';  
372 -// $add_del['type'] = 1;  
373 -// $add_del['money'] = $userNeedList['pay_money'];  
374 -// $add_del['create_time'] = time();  
375 -// $add_del['update_time'] = time();  
376 -// $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);  
377 -// if (!$umoney_id) {  
378 -// Db::rollback();  
379 -// $this->apiResponse('0','金额明细添加失败');  
380 -// }  
381 - $where_memberNext['type'] = 1;  
382 - $where_memberNext['id'] = $userNeedList['user_id'];  
383 - $add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);  
384 - if (!$add_moneyNext) {  
385 - Db::rollback();  
386 - }  
387 - 329 + $refund_result = $this->need_order_refund($userNeedList,'报价人数不足',1);
388 } 330 }
389 // 插入数据库 331 // 插入数据库
390 // 用户需求表 332 // 用户需求表
@@ -396,7 +338,6 @@ class ThirdsendController extends HomeBaseController @@ -396,7 +338,6 @@ class ThirdsendController extends HomeBaseController
396 }else{ 338 }else{
397 $this->apiResponse('0','时间不正确'); 339 $this->apiResponse('0','时间不正确');
398 } 340 }
399 -  
400 // } 341 // }
401 } 342 }
402 343
@@ -425,9 +366,13 @@ class ThirdsendController extends HomeBaseController @@ -425,9 +366,13 @@ class ThirdsendController extends HomeBaseController
425 if($userNeedList){ 366 if($userNeedList){
426 // foreach ($userNeedList as $needk=>$needv) { 367 // foreach ($userNeedList as $needk=>$needv) {
427 if (time() >= ($userNeedList['choose_time'] + 259200)) { 368 if (time() >= ($userNeedList['choose_time'] + 259200)) {
428 - $where_agency['need_id'] = $userNeedList['id'];  
429 - $where_agency['status'] = 4;  
430 - $agency_list = Db::name('Agency')->where($where_agency)->select()->toArray(); 369 + $where_agency['a.need_id'] = $userNeedList['id'];
  370 + $where_agency['a.status'] = 4;
  371 + $agency_list = Db::name('Agency')->alias('a')
  372 + ->where($where_agency)
  373 + ->join("hp_Member m", 'm.id = a.agency_id')
  374 + ->field('a.*,m.company,m.type as user_type')
  375 + ->select()->toArray();
431 if ($agency_list) { 376 if ($agency_list) {
432 $where_agencyUpdate['need_id'] = $userNeedList['id']; 377 $where_agencyUpdate['need_id'] = $userNeedList['id'];
433 $where_agencyUpdate['status'] = 4; 378 $where_agencyUpdate['status'] = 4;
@@ -437,10 +382,6 @@ class ThirdsendController extends HomeBaseController @@ -437,10 +382,6 @@ class ThirdsendController extends HomeBaseController
437 if (!$agency_result) { 382 if (!$agency_result) {
438 Db::rollback(); 383 Db::rollback();
439 } 384 }
440 - foreach ($agency_list as $agency_key=>$agency_val) {  
441 - // 中介报价订单退款  
442 - $refund_result = $this->agency_order_refund($agency_val,'用户未选择中标中介退款');  
443 - }  
444 } 385 }
445 $where_needUpdate['id'] = $userNeedList['id']; 386 $where_needUpdate['id'] = $userNeedList['id'];
446 $needUpdate['status'] = 6; 387 $needUpdate['status'] = 6;
@@ -448,39 +389,12 @@ class ThirdsendController extends HomeBaseController @@ -448,39 +389,12 @@ class ThirdsendController extends HomeBaseController
448 if (!$need_result) { 389 if (!$need_result) {
449 Db::rollback(); 390 Db::rollback();
450 } else { 391 } else {
451 -// 加用户金额明细表  
452 - $add_del['need_id'] = $userNeedList['id'];  
453 - $add_del['user_id'] = $userNeedList['user_id'];  
454 - $add_del['title'] = '未选择中介';  
455 - $add_del['type'] = 2;  
456 - $add_del['money'] = $userNeedList['pay_money'];  
457 - $add_del['create_time'] = time();  
458 - $add_del['update_time'] = time();  
459 - $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);  
460 - if (!$umoney_id) {  
461 - Db::rollback(); 392 + if ($agency_list) {
  393 + foreach ($agency_list as $agency_key => $agency_val) {
  394 + // 中介报价订单退款
  395 + $this->agency_order_refund($agency_val, '用户未选择中标中介退款',3);
  396 + }
462 } 397 }
463 -// 中介金额明细表  
464 -// foreach ($agency_list as $agenk=>$agenv){  
465 -// $add_a['ag_id'] = $agenv['id'];  
466 -// $add_a['user_id'] = $agenv['agency_id'];  
467 -// $add_a['title'] = '用户未选择中介';  
468 -// $add_a['type'] = 1;  
469 -// $add_a['money'] = $agenv['deposit'];  
470 -// $add_a['create_time'] = time();  
471 -// $add_a['update_time'] = time();  
472 -// $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);  
473 -// if (!$amoney_id) {  
474 -// Db::rollback();  
475 -// }  
476 -// $where_member['type'] = 2;  
477 -// $where_member['id'] = $agenv['agency_id'];  
478 -// $add_money = Db::name('Member')->where($where_member)->setInc('money',$agenv['deposit']);  
479 -// if (!$add_money) {  
480 -// Db::rollback();  
481 -// }  
482 -// }  
483 -  
484 } 398 }
485 } 399 }
486 // } 400 // }
@@ -530,18 +444,6 @@ class ThirdsendController extends HomeBaseController @@ -530,18 +444,6 @@ class ThirdsendController extends HomeBaseController
530 Db::rollback(); 444 Db::rollback();
531 } 445 }
532 } 446 }
533 -// 增加中介保证金变化  
534 - $add_a['ag_id'] = $agency['id'];  
535 - $add_a['user_id'] = $agency['agency_id'];  
536 - $add_a['title'] = '中介未确认';  
537 - $add_a['type'] = 2;  
538 - $add_a['money'] = $agency['deposit'];  
539 - $add_a['create_time'] = time();  
540 - $add_a['update_time'] = time();  
541 - $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);  
542 - if (!$amoney_id) {  
543 - Db::rollback();  
544 - }  
545 // 修改用户需求状态 447 // 修改用户需求状态
546 $where_needChange['id'] = $need_list['id']; 448 $where_needChange['id'] = $need_list['id'];
547 $update_need['status'] = 8; 449 $update_need['status'] = 8;
@@ -550,24 +452,8 @@ class ThirdsendController extends HomeBaseController @@ -550,24 +452,8 @@ class ThirdsendController extends HomeBaseController
550 if (!$change_needFinal) { 452 if (!$change_needFinal) {
551 Db::rollback(); 453 Db::rollback();
552 } 454 }
553 -// 增加用户保证金,余额  
554 - $add_del['need_id'] = $need_list['id'];  
555 - $add_del['user_id'] = $need_list['user_id'];  
556 - $add_del['title'] = '中介未确认';  
557 - $add_del['type'] = 1;  
558 - $add_del['money'] = $need_list['pay_money'];  
559 - $add_del['create_time'] = time();  
560 - $add_del['update_time'] = time();  
561 - $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);  
562 - if (!$umoney_id) {  
563 - Db::rollback();  
564 - }  
565 - $where_member['type'] = 1;  
566 - $where_member['id'] = $need_list['user_id'];  
567 - $add_money = Db::name('Member')->where($where_member)->setInc('money',$need_list['pay_money']);  
568 - if (!$add_money) {  
569 - Db::rollback();  
570 - } 455 + $need_list['user_type'] = Db::name('Member')->where(['id'=>$need_list['user_id']])->value('type');
  456 + $this->need_order_refund($agency,'中介未确认成交退款',5);
571 } 457 }
572 // } 458 // }
573 Db::commit(); 459 Db::commit();
@@ -640,7 +526,7 @@ class ThirdsendController extends HomeBaseController @@ -640,7 +526,7 @@ class ThirdsendController extends HomeBaseController
640 // 删除十万以内报价 526 // 删除十万以内报价
641 foreach ($agency_list as $tenk=>$tenv){ 527 foreach ($agency_list as $tenk=>$tenv){
642 $ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge']; 528 $ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge'];
643 - if($ten_money > 1000000){ 529 + if($ten_money > 100000){
644 $is_trueMoney[] = $tenv; 530 $is_trueMoney[] = $tenv;
645 } 531 }
646 } 532 }
@@ -969,7 +855,7 @@ class ThirdsendController extends HomeBaseController @@ -969,7 +855,7 @@ class ThirdsendController extends HomeBaseController
969 * @param needInfo 用户需求信息 855 * @param needInfo 用户需求信息
970 * @param reason 退款原因 856 * @param reason 退款原因
971 */ 857 */
972 - private function need_order_refund($needInfo,$reason) { 858 + public function need_order_refund($needInfo,$reason,$reason_id) {
973 $order_model = new OrderModel(); 859 $order_model = new OrderModel();
974 $where = [ 860 $where = [
975 'user_id' => $needInfo['user_id'], 861 'user_id' => $needInfo['user_id'],
@@ -980,18 +866,20 @@ class ThirdsendController extends HomeBaseController @@ -980,18 +866,20 @@ class ThirdsendController extends HomeBaseController
980 ]; 866 ];
981 // 根据不同订单类型执行退款操作 867 // 根据不同订单类型执行退款操作
982 $orderInfo = $order_model->where($where)->find(); 868 $orderInfo = $order_model->where($where)->find();
  869 + $orderInfo['user_type'] = $needInfo['user_type'];
983 $transaction_id = $orderInfo['transaction_id']; 870 $transaction_id = $orderInfo['transaction_id'];
984 $order_sn = $orderInfo['order_sn']; 871 $order_sn = $orderInfo['order_sn'];
985 - $money = $orderInfo['money']; 872 +// $money = $orderInfo['money'];
  873 + $money = 0.01;
986 $out_refund_no = cmf_get_order_sn(); 874 $out_refund_no = cmf_get_order_sn();
987 // 微信 875 // 微信
988 $refund_result = false; 876 $refund_result = false;
989 if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) { 877 if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) {
990 - $refund_result = $this->wxpay_refund($transaction_id,$out_refund_no,$money,$money,$reason); 878 + $refund_result = $this->wxpay_refund($orderInfo, $transaction_id,$out_refund_no,$money*100,$money*100,$reason,$reason_id);
991 } 879 }
992 // 支付宝 880 // 支付宝
993 if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) { 881 if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) {
994 - $refund_result = $this->alipay_refund($transaction_id,$order_sn,$money,$reason); 882 + $refund_result = $this->alipay_refund($orderInfo, $transaction_id,$order_sn,$money,$reason,$reason_id);
995 } 883 }
996 return $refund_result; 884 return $refund_result;
997 } 885 }
@@ -1001,7 +889,7 @@ class ThirdsendController extends HomeBaseController @@ -1001,7 +889,7 @@ class ThirdsendController extends HomeBaseController
1001 * @param agencyInfo 中介报价信息 889 * @param agencyInfo 中介报价信息
1002 * @param reason 退款原因 890 * @param reason 退款原因
1003 */ 891 */
1004 - private function agency_order_refund($agencyInfo,$reason) { 892 + public function agency_order_refund($agencyInfo,$reason,$reason_id) {
1005 $order_model = new OrderModel(); 893 $order_model = new OrderModel();
1006 $where = [ 894 $where = [
1007 'user_id' => $agencyInfo['agency_id'], 895 'user_id' => $agencyInfo['agency_id'],
@@ -1012,18 +900,20 @@ class ThirdsendController extends HomeBaseController @@ -1012,18 +900,20 @@ class ThirdsendController extends HomeBaseController
1012 ]; 900 ];
1013 // 根据不同订单类型执行退款操作 901 // 根据不同订单类型执行退款操作
1014 $orderInfo = $order_model->where($where)->find(); 902 $orderInfo = $order_model->where($where)->find();
  903 + $orderInfo['user_type'] = $agencyInfo['user_type'];
1015 $transaction_id = $orderInfo['transaction_id']; 904 $transaction_id = $orderInfo['transaction_id'];
1016 $order_sn = $orderInfo['order_sn']; 905 $order_sn = $orderInfo['order_sn'];
1017 - $money = $orderInfo['money']; 906 +// $money = $orderInfo['money'];
  907 + $money = 0.01;
1018 $out_refund_no = cmf_get_order_sn(); 908 $out_refund_no = cmf_get_order_sn();
1019 $refund_result = false; 909 $refund_result = false;
1020 // 微信 910 // 微信
1021 if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) { 911 if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) {
1022 - $refund_result = $this->wxpay_refund($transaction_id,$out_refund_no,$money,$money,$reason); 912 + $refund_result = $this->wxpay_refund($orderInfo, $transaction_id,$out_refund_no,$money*100,$money*100,$reason,$reason_id);
1023 } 913 }
1024 // 支付宝 914 // 支付宝
1025 if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) { 915 if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) {
1026 - $refund_result = $this->alipay_refund($transaction_id,$order_sn,$money,$reason); 916 + $refund_result = $this->alipay_refund($orderInfo, $transaction_id,$order_sn,$money,$reason,$reason_id);
1027 } 917 }
1028 return $refund_result; 918 return $refund_result;
1029 } 919 }
@@ -1036,7 +926,64 @@ class ThirdsendController extends HomeBaseController @@ -1036,7 +926,64 @@ class ThirdsendController extends HomeBaseController
1036 * @param refund_reason 退款原因 926 * @param refund_reason 退款原因
1037 * @param out_request_no 如需部分退款,传此参数 927 * @param out_request_no 如需部分退款,传此参数
1038 */ 928 */
1039 - private function alipay_refund($trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason, $out_request_no = null) { 929 + private function alipay_refund($orderInfo, $trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason,$reason_id, $out_request_no = null) {
  930 + $refund = controller('Alipay','controller');
  931 + $data = [
  932 + 'trade_no' => $trade_no,
  933 + 'out_trade_no' => $out_trade_no,
  934 + 'refund_amount' => $refund_amount,
  935 + 'refund_reason' => $refund_reason,
  936 + 'out_request_no' => $out_request_no
  937 + ];
  938 + $result = $refund->refund($data);
  939 + $refund_model = new RefundModel();
  940 + if($result->code == '10000' && $result->msg == 'Success') {
  941 + $insert = [
  942 + 'order_id' => $orderInfo['id'],
  943 + 'order_sn' => $result->out_trade_no,
  944 + 'user_id' => $orderInfo['user_id'],
  945 + 'user_type' => $orderInfo['user_type'],
  946 + 'refund_id' => $result->trade_no,
  947 + 'pay_type' => 2,
  948 + 'status' => 2,
  949 + 'reason' => $reason_id,
  950 + 'create_time' => time(),
  951 + 'update_time' => time(),
  952 + 'refund_time' => strtotime($result->gmt_refund_pay),
  953 + 'more' => json_encode($result)
  954 + ];
  955 + $refund_result = $refund_model->insertGetId($insert);
  956 + if(!$refund_result) {
  957 + return false;
  958 + }
  959 + return true;
  960 + } else {
  961 + $insert = [
  962 + 'order_id' => $orderInfo['id'],
  963 + 'user_id' => $orderInfo['user_id'],
  964 + 'user_type' => $orderInfo['user_type'],
  965 + 'pay_type' => 2,
  966 + 'status' => 4,
  967 + 'reason' => $reason_id,
  968 + 'create_time' => time(),
  969 + 'update_time' => time(),
  970 + 'refund_time' => time(),
  971 + 'more' => json_encode($result)
  972 + ];
  973 + $refund_model->insertGetId($insert);
  974 + return false;
  975 + }
  976 + }
  977 +
  978 + /**
  979 + * 支付宝退款查询接口(两个订单号不能同时为空)
  980 + * @param trade_no 支付宝交易号
  981 + * @param out_trade_no 商户支付订单号
  982 + * @param refund_amount 退款金额
  983 + * @param refund_reason 退款原因
  984 + * @param out_request_no 如需部分退款,传此参数
  985 + */
  986 + private function alipay_refundquery($trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason, $out_request_no = null) {
1040 $refund = controller('Alipay','controller'); 987 $refund = controller('Alipay','controller');
1041 $data = [ 988 $data = [
1042 'trade_no' => $trade_no, 989 'trade_no' => $trade_no,
@@ -1050,19 +997,153 @@ class ThirdsendController extends HomeBaseController @@ -1050,19 +997,153 @@ class ThirdsendController extends HomeBaseController
1050 997
1051 /** 998 /**
1052 * 微信退款接口(两个订单号不能同时为空) 999 * 微信退款接口(两个订单号不能同时为空)
  1000 + * @param orderInfo 支付订单信息
1053 * @param transaction_id 微信业务订单号 1001 * @param transaction_id 微信业务订单号
1054 * @param out_refund_no 商户退款订单号 1002 * @param out_refund_no 商户退款订单号
1055 * @param total_fee 订单金额 1003 * @param total_fee 订单金额
1056 * @param refund_fee 退款金额 1004 * @param refund_fee 退款金额
1057 * @param refund_desc 退款原因 1005 * @param refund_desc 退款原因
1058 */ 1006 */
1059 - private function wxpay_refund($transaction_id = null, $out_refund_no = null, $total_fee, $refund_fee, $refund_desc) { 1007 + private function wxpay_refund($orderInfo, $transaction_id = null, $out_refund_no = null, $total_fee, $refund_fee, $refund_desc,$reason_id) {
1060 require_once VENDOR_PATH.'WxpayAPI/WxRefund.php'; 1008 require_once VENDOR_PATH.'WxpayAPI/WxRefund.php';
1061 $refund = new \WxRefund(Config::get('wx_appid'),Config::get('wx_mch_id'),Config::get('wx_key'),$transaction_id, 1009 $refund = new \WxRefund(Config::get('wx_appid'),Config::get('wx_mch_id'),Config::get('wx_key'),$transaction_id,
1062 $out_refund_no,$total_fee,$refund_fee,$refund_desc); 1010 $out_refund_no,$total_fee,$refund_fee,$refund_desc);
1063 - return $refund->pay(); 1011 + $result = $refund->pay();
  1012 + if($result['return_code'] == 'SUCCESS' && $result['return_msg'] == 'OK') {
  1013 + $refund_model = new RefundModel();
  1014 +// $refund = $refund_model->where(['order_sn'=>$result['out_refund_no_0']])->find();
  1015 +// if(!empty($refund)) {
  1016 +// return $this->wxpay_refundquery($transaction_id, $out_refund_no, $out_refund_no, $refund['refund_id']);
  1017 +// }
  1018 + if($result['result_code'] == 'SUCCESS') {
  1019 + $insert = [
  1020 + 'order_id' => $orderInfo['id'],
  1021 + 'order_sn' => $result['out_refund_no'],
  1022 + 'user_id' => $orderInfo['user_id'],
  1023 + 'user_type' => $orderInfo['user_type'],
  1024 + 'refund_id' => $result['refund_id'],
  1025 + 'pay_type' => 1,
  1026 + 'reason' => $reason_id,
  1027 + 'create_time' => time(),
  1028 + 'update_time' => time()
  1029 + ];
  1030 + $refund_result = $refund_model->insertGetId($insert);
  1031 + if(!$refund_result) {
  1032 + return false;
  1033 + }
  1034 + }
  1035 +// return $this->wxpay_refundquery($transaction_id, $out_refund_no, $result['out_refund_no'], $insert['refund_id']);
  1036 + } else {
  1037 + Db::name('Test')->insert(['data'=>$result['return_msg']]);
  1038 + return false;
  1039 + }
  1040 + }
  1041 +
  1042 + /**
  1043 + * 微信退款查询接口(四个订单号不能同时为空)
  1044 + * @param transaction_id 微信业务订单号
  1045 + * @param out_trade_no 商户退款订单号
  1046 + * @param out_refund_no 商户退款订单号
  1047 + * @param refund_id 微信退款单号
  1048 + */
  1049 + private function wxpay_refundquery($transaction_id = null, $out_trade_no = null, $out_refund_no = null, $refund_id = null) {
  1050 + require_once VENDOR_PATH.'WxpayAPI/WxRefundQuery.php';
  1051 + $refund = new \WxRefundQuery(Config::get('wx_appid'),Config::get('wx_mch_id'),Config::get('wx_key'),$transaction_id,
  1052 + $out_trade_no,$out_refund_no,$refund_id);
  1053 + $result = $refund->pay();
  1054 + $refund_model = new RefundModel();
  1055 + $refund = $refund_model->where(['refund_id'=>$result['refund_id_0']])->find();
  1056 + if($refund['status'] == 2) {
  1057 + return true;
  1058 + }
  1059 + if($result['return_code'] == 'SUCCESS' && $result['return_msg'] == 'OK') {
  1060 + Db::startTrans();
  1061 + $refund_success_time = 0;
  1062 + if(!empty($result['refund_success_time_0'])) {
  1063 + $refund_success_time = strtotime($result['refund_success_time_0']);
  1064 + }
  1065 + $refund_update = [
  1066 + 'status' => 2,
  1067 + 'update_time' => time(),
  1068 + 'refund_time' => $refund_success_time
  1069 + ];
  1070 + $refund_result = $refund_model->where(['id'=>$refund['id']])->update($refund_update);
  1071 + if(!$refund_result) {
  1072 + Db::rollback();
  1073 + return false;
  1074 + }
  1075 + $order_model = new OrderModel();
  1076 + $order_update = [
  1077 + 'status' => 4,
  1078 + 'update_time' => time(),
  1079 + 'refund_time' => $refund_success_time
  1080 + ];
  1081 + $order_result = $order_model->where(['id'=>$refund['order_id']])->update($order_update);
  1082 + if(!$order_result) {
  1083 + Db::rollback();
  1084 + return false;
  1085 + }
  1086 + Db::commit();
  1087 + } else {
  1088 + $refund_update = [
  1089 + 'status' => 5,
  1090 + 'update_time' => time(),
  1091 + 'remark' => $result['return_msg']
  1092 + ];
  1093 + $refund_result = $refund_model->where(['id'=>$refund['id']])->update($refund_update);
  1094 + return false;
  1095 + }
1064 } 1096 }
1065 1097
1066 1098
1067 1099
  1100 +
  1101 +
  1102 +// 发布需求,匹配中介(暂未调用)
  1103 + public function sendNeed($need_id){
  1104 + header("Content-Type: text/html;charset=utf-8");
  1105 + $where_need['id'] = $need_id;
  1106 + $where_need['status'] = 3;
  1107 + $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters")->find();
  1108 + $final_arr = array();
  1109 + $code = 'SMS_137674888';
  1110 + $where_member['type'] = 2;
  1111 + $where_member['status'] = array('neq','8,9');
  1112 +// 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配)
  1113 + $member_find = Db::name('Member')->where($where_member)->field("id,name,tel,city,quarters")->select()->toArray();
  1114 + foreach ($member_find as $mek=>$mev){
  1115 + if($need_list['city'] == $mev['city']){
  1116 + $quarters = explode('+',$mev['quarters']);
  1117 + foreach ($quarters as $quak=>$quav){
  1118 + if(strstr($need_list['quarters'],$quav) !== false){
  1119 + $final_arr[] = $mev;
  1120 + $final_tel[] = $mev['tel'];
  1121 + $middle_arr['name'] = $mev['name'];
  1122 + $middle_arr['name2'] = $need_list['quarters'];
  1123 + $final_mes[] = $middle_arr;
  1124 + $final_autograph[] = '比房价';
  1125 + }
  1126 + }
  1127 + }
  1128 + }
  1129 + $json_tel = json_encode($final_tel,JSON_UNESCAPED_UNICODE);
  1130 + $json_mes = json_encode($final_mes,JSON_UNESCAPED_UNICODE);
  1131 + $json_autograph = json_encode($final_autograph,JSON_UNESCAPED_UNICODE);
  1132 + $res_mes = $this->sendLogin($json_tel,$code,$json_mes,$json_autograph);
  1133 + if($res_mes != 'OK'){
  1134 + $this->apiResponse('0',$res_mes);
  1135 + }
  1136 +
  1137 + }
  1138 +
  1139 +
  1140 +
  1141 + // 短信验证码
  1142 + public function sendLogin($tel,$code,$modelVal,$json_autograph){
  1143 + require_once VENDOR_PATH."aliyun-dysms-php-sdk/api_demo/SmsDemo.php";
  1144 + set_time_limit(0);
  1145 + header('Content-Type: text/plain; charset=utf-8');
  1146 + $response = SmsDemo::sendBatchSms($tel,$code,$modelVal,$json_autograph);
  1147 + return $response;
  1148 + }
1068 } 1149 }
@@ -742,6 +742,7 @@ class UserController extends CommonController @@ -742,6 +742,7 @@ class UserController extends CommonController
742 $add_final = Db::name('Card')->where($where_add)->update($add); 742 $add_final = Db::name('Card')->where($where_add)->update($add);
743 if($add_final){ 743 if($add_final){
744 $final['card_id'] = $add_final; 744 $final['card_id'] = $add_final;
  745 + $final['user'] = $user;
745 $this->apiResponse('1','成功',$final); 746 $this->apiResponse('1','成功',$final);
746 }else{ 747 }else{
747 $this->apiResponse('0','添加失败'); 748 $this->apiResponse('0','添加失败');
@@ -758,6 +759,7 @@ class UserController extends CommonController @@ -758,6 +759,7 @@ class UserController extends CommonController
758 $bank = Db::name('Bank')->where($where_bank)->order('score desc,create_time desc')->select(); 759 $bank = Db::name('Bank')->where($where_bank)->order('score desc,create_time desc')->select();
759 $final['bank'] = $bank; 760 $final['bank'] = $bank;
760 $final['card'] = $cardFind; 761 $final['card'] = $cardFind;
  762 + $final['user'] = $user;
761 if($cardFind){ 763 if($cardFind){
762 $this->apiResponse('1','成功',$final); 764 $this->apiResponse('1','成功',$final);
763 }else{ 765 }else{
@@ -865,14 +867,19 @@ class UserController extends CommonController @@ -865,14 +867,19 @@ class UserController extends CommonController
865 $member = $this->myleft($token); 867 $member = $this->myleft($token);
866 $data = $request->param(); 868 $data = $request->param();
867 $page = $data['page']?$data['page']:1; 869 $page = $data['page']?$data['page']:1;
868 - 870 + $size = 2;
869 $final['user'] = $member; 871 $final['user'] = $member;
870 $where_userNeed['user_id'] = $member['id']; 872 $where_userNeed['user_id'] = $member['id'];
871 $where_userNeed['status'] = array('neq',9); 873 $where_userNeed['status'] = array('neq',9);
872 $user_need = Db::name('UserNeed')->where($where_userNeed) 874 $user_need = Db::name('UserNeed')->where($where_userNeed)
873 ->order('create_time desc') 875 ->order('create_time desc')
  876 + ->limit($size)
874 ->page($page) 877 ->page($page)
875 ->select()->toArray(); 878 ->select()->toArray();
  879 +
  880 + $all_page = Db::name('UserNeed')->where($where_userNeed)
  881 + ->order('create_time desc')
  882 + ->count();
876 if($user_need){ 883 if($user_need){
877 foreach ($user_need as $unk=>$unv){ 884 foreach ($user_need as $unk=>$unv){
878 $where_comment['need_id'] = $unv['id']; 885 $where_comment['need_id'] = $unv['id'];
@@ -900,6 +907,7 @@ class UserController extends CommonController @@ -900,6 +907,7 @@ class UserController extends CommonController
900 $final['user_need'] = array(); 907 $final['user_need'] = array();
901 } 908 }
902 $final['user'] = $member; 909 $final['user'] = $member;
  910 + $final['all_page'] = ceil($all_page/$size);
903 $this->apiResponse('1','成功',$final); 911 $this->apiResponse('1','成功',$final);
904 } 912 }
905 913
@@ -1053,7 +1061,7 @@ class UserController extends CommonController @@ -1053,7 +1061,7 @@ class UserController extends CommonController
1053 1061
1054 1062
1055 /** 1063 /**
1056 - * @title 确认成交(sure) 1064 + * @title 用户选择中介(sure)
1057 * @description 接口说明 1065 * @description 接口说明
1058 * @author 开发者 1066 * @author 开发者
1059 * @url /api/portal/User/sureAgency 1067 * @url /api/portal/User/sureAgency
@@ -1074,10 +1082,12 @@ class UserController extends CommonController @@ -1074,10 +1082,12 @@ class UserController extends CommonController
1074 if(!$user_need){ 1082 if(!$user_need){
1075 $this->apiResponse('0','状态错误'); 1083 $this->apiResponse('0','状态错误');
1076 } 1084 }
  1085 + Db::startTrans();
1077 $need_update['status'] = 7; 1086 $need_update['status'] = 7;
1078 $need_update['next_choose_time'] = time(); 1087 $need_update['next_choose_time'] = time();
1079 $need_res = Db::name('UserNeed')->where($where_need)->update($need_update); 1088 $need_res = Db::name('UserNeed')->where($where_need)->update($need_update);
1080 if(!$need_res){ 1089 if(!$need_res){
  1090 + Db::rollback();
1081 $this->apiResponse('0','成交失败'); 1091 $this->apiResponse('0','成交失败');
1082 } 1092 }
1083 $where_bid['need_id'] = $data['need_id']; 1093 $where_bid['need_id'] = $data['need_id'];
@@ -1088,19 +1098,37 @@ class UserController extends CommonController @@ -1088,19 +1098,37 @@ class UserController extends CommonController
1088 $where_ag['id'] = $data['intermediary_id']; 1098 $where_ag['id'] = $data['intermediary_id'];
1089 $add['status'] = 5; 1099 $add['status'] = 5;
1090 $add['update_time'] = time(); 1100 $add['update_time'] = time();
  1101 + $add['count_deal'] = $is_isset['count_deal']+1;
1091 $need_update['choose_time'] = time(); 1102 $need_update['choose_time'] = time();
1092 $save = Db::name('Agency')->where($where_ag)->update($add); 1103 $save = Db::name('Agency')->where($where_ag)->update($add);
1093 if($save){ 1104 if($save){
  1105 + $where_unchoose = [
  1106 + 'a.need_id' => $data['need_id'],
  1107 + 'a.id' => ['neq',$data['intermediary_id']]
  1108 + ];
  1109 + $agency_unchoose = Db::name('Agency')->alias('a')
  1110 + ->where($where_unchoose)
  1111 + ->join("hp_Member m", 'm.id = a.agency_id')
  1112 + ->field('a.*,m.company,m.type as user_type')->select()->toArray();
  1113 + $thirdsend = controller('Thirdsend','controller');
  1114 + foreach ($agency_unchoose as $k=>$v) {
  1115 + $thirdsend->agency_order_refund($v,'中介复选未中标退款',4);
  1116 + }
  1117 + Db::commit();
1094 $this->apiResponse('1','确认成功'); 1118 $this->apiResponse('1','确认成功');
1095 }else{ 1119 }else{
  1120 + Db::rollback();
1096 $this->apiResponse('0','成交失败'); 1121 $this->apiResponse('0','成交失败');
1097 } 1122 }
1098 }else{ 1123 }else{
  1124 + Db::rollback();
1099 $this->apiResponse('0','报价选择有误'); 1125 $this->apiResponse('0','报价选择有误');
1100 } 1126 }
1101 } 1127 }
1102 1128
1103 1129
  1130 +
  1131 +
1104 /** 1132 /**
1105 * @title 查看评价(sure) 1133 * @title 查看评价(sure)
1106 * @description 接口说明 1134 * @description 接口说明
@@ -1179,16 +1207,16 @@ class UserController extends CommonController @@ -1179,16 +1207,16 @@ class UserController extends CommonController
1179 if($change_com){ 1207 if($change_com){
1180 $this->apiResponse('1','评价成功',$add_result); 1208 $this->apiResponse('1','评价成功',$add_result);
1181 }else{ 1209 }else{
1182 - $this->apiResponse('0','评价失败'); 1210 + $this->apiResponse('0','评价失败1');
1183 } 1211 }
1184 }else{ 1212 }else{
1185 - $this->apiResponse('0','评价失败'); 1213 + $this->apiResponse('0','评价失败2');
1186 } 1214 }
1187 }else{ 1215 }else{
1188 - $this->apiResponse('0','评价失败'); 1216 + $this->apiResponse('0','评价失败3');
1189 } 1217 }
1190 }else{ 1218 }else{
1191 - $this->apiResponse('0','评价失败'); 1219 + $this->apiResponse('0','评价失败4');
1192 } 1220 }
1193 } 1221 }
1194 1222
@@ -1260,6 +1288,8 @@ class UserController extends CommonController @@ -1260,6 +1288,8 @@ class UserController extends CommonController
1260 } 1288 }
1261 $where_find['n.id'] = $data['need_id']; 1289 $where_find['n.id'] = $data['need_id'];
1262 $where_find['a.id'] = $data['intermediary_id']; 1290 $where_find['a.id'] = $data['intermediary_id'];
  1291 + $where_find['n.status'] = array('in','7,10,11');
  1292 + $where_find['a.status'] = 5;
1263 $find = Db::name('UserNeed')->alias('n') 1293 $find = Db::name('UserNeed')->alias('n')
1264 ->where($where_find) 1294 ->where($where_find)
1265 ->join("Agency a",'a.need_id = n.id') 1295 ->join("Agency a",'a.need_id = n.id')
@@ -104,7 +104,7 @@ class UserneedController extends CommonController @@ -104,7 +104,7 @@ class UserneedController extends CommonController
104 */ 104 */
105 public function send(Request $request) 105 public function send(Request $request)
106 { 106 {
107 -// header("Access-Control-Allow-Origin: *"); 107 + Db::startTrans();
108 if($request->Post('token') && $request->Post('name')){ 108 if($request->Post('token') && $request->Post('name')){
109 // $data = $request->param(); 109 // $data = $request->param();
110 // 判空,处理 110 // 判空,处理
@@ -134,6 +134,7 @@ class UserneedController extends CommonController @@ -134,6 +134,7 @@ class UserneedController extends CommonController
134 if($elsemoney){ 134 if($elsemoney){
135 $data['pay_money'] = $elsemoney['money']; 135 $data['pay_money'] = $elsemoney['money'];
136 }else{ 136 }else{
  137 + Db::rollback();
137 $this->apiResponse('0','保证金获取失败'); 138 $this->apiResponse('0','保证金获取失败');
138 } 139 }
139 }else{ 140 }else{
@@ -151,8 +152,10 @@ class UserneedController extends CommonController @@ -151,8 +152,10 @@ class UserneedController extends CommonController
151 152
152 if($save){ 153 if($save){
153 $final['userNeed_id'] = $model->getLastInsID(); 154 $final['userNeed_id'] = $model->getLastInsID();
  155 + Db::commit();
154 $this->apiResponse('1','添加成功',$final); 156 $this->apiResponse('1','添加成功',$final);
155 }else{ 157 }else{
  158 + Db::rollback();
156 $this->apiResponse('0','添加失败'); 159 $this->apiResponse('0','添加失败');
157 } 160 }
158 }else{ 161 }else{
@@ -10,7 +10,9 @@ @@ -10,7 +10,9 @@
10 // +---------------------------------------------------------------------- 10 // +----------------------------------------------------------------------
11 namespace app\portal\controller; 11 namespace app\portal\controller;
12 12
  13 +use app\admin\model\ThemeModel;
13 use app\portal\model\CooperationModel; 14 use app\portal\model\CooperationModel;
  15 +use app\portal\model\PortalPostModel;
14 use cmf\controller\AdminBaseController; 16 use cmf\controller\AdminBaseController;
15 use app\portal\model\PortalTagModel; 17 use app\portal\model\PortalTagModel;
16 use app\portal\service\PostService; 18 use app\portal\service\PostService;
@@ -145,4 +147,41 @@ class CooperationController extends AdminBaseController @@ -145,4 +147,41 @@ class CooperationController extends AdminBaseController
145 } 147 }
146 } 148 }
147 149
  150 +
  151 +// 两分钟视频
  152 + public function video(){
  153 + if ($this->request->isPost()) {
  154 + $data = $this->request->param();
  155 + if (!empty($data['file_names']) && !empty($data['file_urls'])) {
  156 + $data['post']['more']['files'] = [];
  157 + foreach ($data['file_urls'] as $key => $url) {
  158 + $fileUrl = cmf_asset_relative_url($url);
  159 + $first = str_split($fileUrl,4);
  160 + if($first[0] == 'http'){
  161 + $add['path'] = $fileUrl;
  162 + }else{
  163 + $add['path'] = cmf_get_asset_url($fileUrl);
  164 + }
  165 + $add['update_time'] = time();
  166 + $where_change['id'] = 1;
  167 + $res = Db::name('Video')->where($where_change)->update($add);
  168 + if($res){
  169 + $this->success('修改成功',url('Cooperation/video'));
  170 + }else{
  171 + $this->error('添加失败');
  172 + }
  173 + }
  174 + }else{
  175 + $this->error('视频不能为空');
  176 + }
  177 + }else{
  178 + $where_status['status'] = 1;
  179 + $video = Db::name('Video')->where($where_status)->find();
  180 + $this->assign('video',$video);
  181 + return $this->fetch();
  182 + }
  183 +
  184 + }
  185 +
  186 +
148 } 187 }
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: Powerless < wzxaini9@gmail.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace app\portal\controller;
  12 +
  13 +use cmf\controller\AdminBaseController;
  14 +use think\Db;
  15 +use think\Loader;
  16 +use think\Request;
  17 +
  18 +class RefundController extends AdminBaseController
  19 +{
  20 +
  21 +// 提现申请
  22 + public function index(){
  23 + $data = $this->request->param();
  24 + if($data){
  25 + $startTime = empty($data['start_time']) ? 0 : strtotime($data['start_time']);
  26 + $endTime = empty($data['end_time']) ? 0 : strtotime($data['end_time']);
  27 + if ($startTime && $endTime) {
  28 + $where_money['r.create_time'] = array('between',"$startTime,$endTime");
  29 + $this->assign('start_time', $data['start_time']);
  30 + $this->assign('end_time', $data['end_time']);
  31 + }else{
  32 + if($startTime){
  33 + $where_money['r.create_time'] = array('egt',$startTime);
  34 + $this->assign('start_time', $data['start_time']);
  35 + }
  36 + if($endTime){
  37 + $where_money['r.create_time'] = array('elt',$endTime);
  38 + $this->assign('end_time', $data['end_time']);
  39 + }
  40 + }
  41 + if(!empty($data['name'])){
  42 + $where_money['m.name'] = array('like','%'.$data['name'].'%');
  43 + $this->assign('name', $data['name']);
  44 + }
  45 + if(!empty($data['tel'])){
  46 + $where_money['m.tel'] = array('like','%'.$data['tel'].'%');
  47 + $this->assign('tel', $data['tel']);
  48 + }
  49 + }
  50 + $where_money['r.status'] = array('neq',9);
  51 + $money_list = Db::name('Refund')->alias('r')
  52 + ->join("Member m",'m.id = r.user_id')
  53 + ->where($where_money)
  54 + ->field("m.name,m.tel,r.*")
  55 + ->paginate();
  56 + $page = $money_list->render();
  57 + $this->assign('page',$page);
  58 + $this->assign('lists',$money_list);
  59 + return $this->fetch('index');
  60 + }
  61 +
  62 +
  63 +
  64 +// 同意投诉
  65 + public function agree(){
  66 + $data = $this->request->param();
  67 + $where_money['id'] = $data['id'];
  68 + $where_money['status'] = array('neq',9);
  69 + $money = Db::name('Complaint')->where($where_money)->find();
  70 + if($money){
  71 + $save['status'] = 2;
  72 + $save['update_time'] = time();
  73 + $update = Db::name('Complaint')->where($where_money)->update($save);
  74 + if($update){
  75 + $this->success('成功');
  76 + }else{
  77 + $this->error('失败');
  78 + }
  79 + }else{
  80 + $this->error('投诉状态不正确');
  81 + }
  82 + }
  83 +
  84 + // 拒绝投诉
  85 + public function refuse(){
  86 + $data = $this->request->param();
  87 + $where_money['id'] = $data['id'];
  88 + $where_money['status'] = array('neq',9);
  89 + $money = Db::name('Complaint')->where($where_money)->find();
  90 + if($money){
  91 + $save['status'] = 3;
  92 + $save['update_time'] = time();
  93 + $update = Db::name('Complaint')->where($where_money)->update($save);
  94 + if($update){
  95 + $where_need['id'] = $money['need_id'];
  96 + $where_need['status'] = array('neq',9);
  97 + $findNeed = Db::name('UserNeed')->where($where_need)->find();
  98 + $needTime = ($findNeed['next_choose_time']+259200)-$findNeed['complaint_time'];
  99 + $change_need['refuse_complaint_time'] = time()+$needTime;
  100 + $change_need['status'] = 14;
  101 + $saveNeed = Db::name('UserNeed')->where($where_need)->update($change_need);
  102 + if(!$saveNeed){
  103 + $this->error('拒绝失败');
  104 + }
  105 + $where_agency['id'] = $money['intermediary_id'];
  106 + $where_agency['status'] = array('neq',9);
  107 + $findAgency = Db::name('UserNeed')->where($where_agency)->find();
  108 + $agencyTime = ($findAgency['choose_time']+259200)-$findAgency['complaint_time'];
  109 + $change_agency['refuse_complaint_time'] = time()+$agencyTime;
  110 + $change_agency['status'] = 14;
  111 + $saveAgency = Db::name('UserNeed')->where($where_agency)->update($change_agency);
  112 + if(!$saveAgency){
  113 + $this->error('拒绝失败');
  114 + }
  115 + $this->success('成功');
  116 + }else{
  117 + $this->error('失败');
  118 + }
  119 + }else{
  120 + $this->error('订单状态不正确');
  121 + }
  122 + }
  123 +
  124 +
  125 +
  126 +
  127 + /**
  128 + * 后台删除第三方用户绑定
  129 + * @adminMenu(
  130 + * 'name' => '删除第三方用户绑定',
  131 + * 'parent' => 'index',
  132 + * 'display'=> false,
  133 + * 'hasView'=> false,
  134 + * 'order' => 10000,
  135 + * 'icon' => '',
  136 + * 'remark' => '删除第三方用户绑定',
  137 + * 'param' => ''
  138 + * )
  139 + */
  140 + public function delete()
  141 + {
  142 + $id = input('param.id', 0, 'intval');
  143 + if (empty($id)) {
  144 + $this->error('非法数据!');
  145 + }
  146 + Db::name("third_party_user")->where("id", $id)->delete();
  147 + $this->success("删除成功!", "admin_oauth/index");
  148 + }
  149 +
  150 +}
@@ -45,7 +45,7 @@ class StatisticsController extends AdminBaseController @@ -45,7 +45,7 @@ class StatisticsController extends AdminBaseController
45 45
46 46
47 47
48 -// 列表 48 +// 注册
49 public function index(Request $request) 49 public function index(Request $request)
50 { 50 {
51 return $this->fetch('index'); 51 return $this->fetch('index');
@@ -123,4 +123,364 @@ class StatisticsController extends AdminBaseController @@ -123,4 +123,364 @@ class StatisticsController extends AdminBaseController
123 123
124 } 124 }
125 125
  126 +
  127 +// 缴纳金额
  128 + public function money(Request $request)
  129 + {
  130 + return $this->fetch();
  131 + }
  132 + public function findmoney(){
  133 + $data = $this->request->param();
  134 + foreach ($data['time'] as $tk=>$tv){
  135 + $time[$tk]['start_time'] = strtotime($tv);
  136 + $time[$tk]['end_time'] = strtotime($tv)+86400;
  137 + }
  138 + $start_time = '';
  139 + $end_time = '';
  140 +// 用户
  141 + $where_member['status'] = array('neq','1,9');
  142 + $all_member = Db::name('UserNeed')
  143 +// ->alias('n')
  144 +// ->join('Member m','m.id = n.user_id')
  145 + ->where($where_member)
  146 + ->field('pay_money,pay_time,status')
  147 + ->select()->toArray();
  148 +// 中介
  149 + $where_agency['status'] = array('neq','1,9');
  150 + $all_agency = Db::name('Agency')
  151 +// ->alias('a')
  152 +// ->join('Member m','m.id = a.user_id')
  153 + ->where($where_agency)
  154 + ->field('deposit,pay_time,status')
  155 + ->select()->toArray();
  156 + $pie_user = 0;
  157 + $pie_member = 0;
  158 +// 筛选时间判断
  159 + if(!empty($data['start_time']) || !empty($data['end_time'])) {
  160 +// 搜索
  161 + if (!empty($data['start_time'])) {
  162 + $start_time = strtotime($data['start_time']);
  163 + }
  164 + if (!empty($data['end_time'])) {
  165 + $end_time = strtotime($data['end_time']);
  166 + }
  167 +
  168 + }else{
  169 +// 默认
  170 + $date_str = date('Y-m-d',time());
  171 + $date_time = strtotime($date_str);
  172 + $end_time = time();
  173 + $start_time = $date_time;
  174 + }
  175 +// 筛选状态
  176 + if(!empty($data['status'])){
  177 +// 进行中
  178 + if($data['status'] == 1){
  179 + $userStatus = array('2','3','4','5','6','7','8','12','13','14');
  180 + $agencyStatus = array('2','3','4','5','6','7','8','10','12','13','14');
  181 + }
  182 +// 已成交
  183 + if($data['status'] == 2){
  184 + $userStatus = array('10','11');
  185 + $agencyStatus = array('11');
  186 + }
  187 + }else{
  188 + $userStatus = array('2','3','4','5','6','7','8','10','11','12','13','14') ;
  189 + $agencyStatus = array('2','3','4','5','6','7','8','10','11','12','13','14') ;
  190 + }
  191 +
  192 +// 用户饼状图
  193 + foreach ($all_member as $mk => $mv) {
  194 + if ($mv['pay_time'] >= $start_time && $mv['pay_time'] <= $end_time) {
  195 + if(in_array($mv['status'],$userStatus)){
  196 + $pie_user += $mv['pay_money'];
  197 + }
  198 + }
  199 + }
  200 +// 中介饼状图
  201 + foreach ($all_agency as $ak => $av) {
  202 + if ($av['pay_time'] >= $start_time && $av['pay_time'] <= $end_time) {
  203 + if(in_array($av['status'],$agencyStatus)){
  204 + $pie_member += $av['deposit'];
  205 + }
  206 +
  207 + }
  208 + }
  209 +
  210 +// 用户柱状图
  211 + foreach ($time as $timekF=>$timevF){
  212 + $user_add = 0;
  213 +// $member_add = 0;
  214 + foreach ($all_member as $memberk=>$memberv){
  215 + // 判断时间
  216 + if($memberv['pay_time'] >=$timevF['start_time'] && $memberv['pay_time'] <=$timevF['end_time']){
  217 + $user_add += $memberv['pay_money'];
  218 + }
  219 + }
  220 + $user[] = $user_add;
  221 + }
  222 +
  223 +// 中介柱状图
  224 + foreach ($time as $timek=>$timev){
  225 + $member_add = 0;
  226 + foreach ($all_agency as $agencyk=>$agencyv){
  227 + // 判断时间
  228 + if($agencyv['pay_time'] >=$timev['start_time'] && $agencyv['pay_time'] <=$timev['end_time']){
  229 +//
  230 + $member_add += $agencyv['deposit'];
  231 + }
  232 + }
  233 + $member[] = $member_add;
  234 +
  235 + }
  236 + $final['user'] = $user;
  237 + $final['member'] = $member;
  238 + $final['start_time'] = $start_time;
  239 + $final['end_time'] = $end_time;
  240 + $final['pie_user'] = $pie_user;
  241 + $final['pie_member'] = $pie_member;
  242 + $this->apiResponse('1','成功',$final);
  243 +
  244 +
  245 + }
  246 +
  247 +
  248 +// 提现
  249 + public function cash(Request $request)
  250 + {
  251 + return $this->fetch();
  252 + }
  253 + public function findcash(){
  254 + // 注册人数
  255 + $data = $this->request->param();
  256 + foreach ($data['time'] as $tk=>$tv){
  257 + $time[$tk]['start_time'] = strtotime($tv);
  258 + $time[$tk]['end_time'] = strtotime($tv)+86400;
  259 + }
  260 + $start_time = '';
  261 + $end_time = '';
  262 + $where_member['status'] = array('neq',9);
  263 + $where_member['type'] = 3;
  264 + $all_member = Db::name('MoneyDetail')->where($where_member)->field('user_type,money,create_time')
  265 + ->select()->toArray();
  266 + $pie_user = 0;
  267 + $pie_member = 0;
  268 +// 筛选时间判断
  269 + if(!empty($data['start_time']) || !empty($data['end_time'])) {
  270 +// 搜索
  271 + if (!empty($data['start_time'])) {
  272 + $start_time = strtotime($data['start_time']);
  273 + }
  274 + if (!empty($data['end_time'])) {
  275 + $end_time = strtotime($data['end_time']);
  276 + }
  277 +
  278 + }else{
  279 +// 默认
  280 + $date_str = date('Y-m-d',time());
  281 + $date_time = strtotime($date_str);
  282 + $end_time = time();
  283 + $start_time = $date_time;
  284 + }
  285 +// 饼状图
  286 + foreach ($all_member as $mk => $mv) {
  287 + if ($mv['create_time'] >= $start_time && $mv['create_time'] <= $end_time) {
  288 + if ($mv['user_type'] == 1) {
  289 + $pie_user += $mv['money'];
  290 + } else {
  291 + $pie_member += $mv['money'];
  292 + }
  293 + }
  294 + }
  295 +
  296 +// 柱状图
  297 + foreach ($time as $timek=>$timev){
  298 + $user_add = 0;
  299 + $member_add = 0;
  300 + foreach ($all_member as $memberk=>$memberv){
  301 + // 判断时间
  302 + if($memberv['create_time'] >=$timev['start_time'] && $memberv['create_time'] <=$timev['end_time']){
  303 +// 判断类型
  304 + if($memberv['user_type'] == 1){
  305 + $user_add += $memberv['money'];
  306 + }else{
  307 + $member_add += $memberv['money'];
  308 + }
  309 + }
  310 + }
  311 + $user[] = $user_add;
  312 + $member[] = $member_add;
  313 +
  314 + }
  315 +
  316 + $final['user'] = $user;
  317 + $final['member'] = $member;
  318 + $final['start_time'] = $start_time;
  319 + $final['end_time'] = $end_time;
  320 + $final['pie_user'] = $pie_user;
  321 + $final['pie_member'] = $pie_member;
  322 + $this->apiResponse('1','成功',$final);
  323 +
  324 +
  325 + }
  326 +
  327 +// 奖励
  328 + public function getmoney(Request $request)
  329 + {
  330 + return $this->fetch();
  331 + }
  332 + public function findgetmoney(){
  333 + // 注册人数
  334 + $data = $this->request->param();
  335 + foreach ($data['time'] as $tk=>$tv){
  336 + $time[$tk]['start_time'] = strtotime($tv);
  337 + $time[$tk]['end_time'] = strtotime($tv)+86400;
  338 + }
  339 + $start_time = '';
  340 + $end_time = '';
  341 + $where_member['status'] = array('neq',9);
  342 + $where_member['order_type'] = 7;
  343 + $all_member = Db::name('MoneyDetail')->where($where_member)->field('user_type,money,create_time')
  344 + ->select()->toArray();
  345 + $pie_user = 0;
  346 + $pie_member = 0;
  347 +// 筛选时间判断
  348 + if(!empty($data['start_time']) || !empty($data['end_time'])) {
  349 +// 搜索
  350 + if (!empty($data['start_time'])) {
  351 + $start_time = strtotime($data['start_time']);
  352 + }
  353 + if (!empty($data['end_time'])) {
  354 + $end_time = strtotime($data['end_time']);
  355 + }
  356 +
  357 + }else{
  358 +// 默认
  359 + $date_str = date('Y-m-d',time());
  360 + $date_time = strtotime($date_str);
  361 + $end_time = time();
  362 + $start_time = $date_time;
  363 + }
  364 +// 饼状图
  365 + foreach ($all_member as $mk => $mv) {
  366 + if ($mv['create_time'] >= $start_time && $mv['create_time'] <= $end_time) {
  367 + if ($mv['user_type'] == 1) {
  368 + $pie_user += $mv['money'];
  369 + } else {
  370 + $pie_member += $mv['money'];
  371 + }
  372 + }
  373 + }
  374 +
  375 +// 柱状图
  376 + foreach ($time as $timek=>$timev){
  377 + $user_add = 0;
  378 + $member_add = 0;
  379 + foreach ($all_member as $memberk=>$memberv){
  380 + // 判断时间
  381 + if($memberv['create_time'] >=$timev['start_time'] && $memberv['create_time'] <=$timev['end_time']){
  382 +// 判断类型
  383 + if($memberv['user_type'] == 1){
  384 + $user_add += $memberv['money'];
  385 + }else{
  386 + $member_add += $memberv['money'];
  387 + }
  388 + }
  389 + }
  390 + $user[] = $user_add;
  391 + $member[] = $member_add;
  392 +
  393 + }
  394 +
  395 + $final['user'] = $user;
  396 + $final['member'] = $member;
  397 + $final['start_time'] = $start_time;
  398 + $final['end_time'] = $end_time;
  399 + $final['pie_user'] = $pie_user;
  400 + $final['pie_member'] = $pie_member;
  401 + $this->apiResponse('1','成功',$final);
  402 +
  403 +
  404 + }
  405 +
  406 +// 透视卡
  407 + public function elseMoney(Request $request)
  408 + {
  409 + return $this->fetch();
  410 + }
  411 + public function findelse(){
  412 + // 注册人数
  413 + $data = $this->request->param();
  414 + foreach ($data['time'] as $tk=>$tv){
  415 + $time[$tk]['start_time'] = strtotime($tv);
  416 + $time[$tk]['end_time'] = strtotime($tv)+86400;
  417 + }
  418 + $start_time = '';
  419 + $end_time = '';
  420 + $where_member['status'] = array('neq',9);
  421 + $where_member['order_type'] = 8;
  422 + $all_member = Db::name('MoneyDetail')->where($where_member)->field('user_type,money,create_time')
  423 + ->select()->toArray();
  424 + $pie_user = 0;
  425 + $pie_member = 0;
  426 +// 筛选时间判断
  427 + if(!empty($data['start_time']) || !empty($data['end_time'])) {
  428 +// 搜索
  429 + if (!empty($data['start_time'])) {
  430 + $start_time = strtotime($data['start_time']);
  431 + }
  432 + if (!empty($data['end_time'])) {
  433 + $end_time = strtotime($data['end_time']);
  434 + }
  435 +
  436 + }else{
  437 +// 默认
  438 + $date_str = date('Y-m-d',time());
  439 + $date_time = strtotime($date_str);
  440 + $end_time = time();
  441 + $start_time = $date_time;
  442 + }
  443 +// 饼状图
  444 + foreach ($all_member as $mk => $mv) {
  445 + if ($mv['create_time'] >= $start_time && $mv['create_time'] <= $end_time) {
  446 + if ($mv['user_type'] == 1) {
  447 + $pie_user += $mv['money'];
  448 + } else {
  449 + $pie_member += $mv['money'];
  450 + }
  451 + }
  452 + }
  453 +
  454 +// 柱状图
  455 + foreach ($time as $timek=>$timev){
  456 + $user_add = 0;
  457 + $member_add = 0;
  458 + foreach ($all_member as $memberk=>$memberv){
  459 + // 判断时间
  460 + if($memberv['create_time'] >=$timev['start_time'] && $memberv['create_time'] <=$timev['end_time']){
  461 +// 判断类型
  462 + if($memberv['user_type'] == 1){
  463 + $user_add += $memberv['money'];
  464 + }else{
  465 + $member_add += $memberv['money'];
  466 + }
  467 + }
  468 + }
  469 + $user[] = $user_add;
  470 + $member[] = $member_add;
  471 +
  472 + }
  473 +
  474 + $final['user'] = $user;
  475 + $final['member'] = $member;
  476 + $final['start_time'] = $start_time;
  477 + $final['end_time'] = $end_time;
  478 + $final['pie_user'] = $pie_user;
  479 + $final['pie_member'] = $pie_member;
  480 + $this->apiResponse('1','成功',$final);
  481 +
  482 +
  483 + }
  484 +
  485 +
126 } 486 }
@@ -161,17 +161,23 @@ return array ( @@ -161,17 +161,23 @@ return array (
161 'PORTAL_COMPLAINT_INDEX' => '投诉管理', 161 'PORTAL_COMPLAINT_INDEX' => '投诉管理',
162 'PORTAL_COOPERATION_DEFAULT' => '首页内容管理', 162 'PORTAL_COOPERATION_DEFAULT' => '首页内容管理',
163 'PORTAL_COOPERATION_INDEX' => '合作企业列表', 163 'PORTAL_COOPERATION_INDEX' => '合作企业列表',
  164 + 'PORTAL_COOPERATION_VIDEO' => '两分钟视频',
164 'PORTAL_NEED_INDEX' => '需求管理', 165 'PORTAL_NEED_INDEX' => '需求管理',
165 - 'PORTAL_NEED_USER' => '需求管理',  
166 'PORTAL_NEW_INDEX' => '最新成交公布', 166 'PORTAL_NEW_INDEX' => '最新成交公布',
167 'PORTAL_PROCESS_INDEX' => '交易流程', 167 'PORTAL_PROCESS_INDEX' => '交易流程',
  168 + 'PORTAL_REFUND_INDEX' => '退款管理',
168 'PORTAL_REWARD_DEFAULT' => '推广奖励设置', 169 'PORTAL_REWARD_DEFAULT' => '推广奖励设置',
169 'PORTAL_REWARD_EARNEST' => '缴纳诚意金后奖励设置', 170 'PORTAL_REWARD_EARNEST' => '缴纳诚意金后奖励设置',
170 'PORTAL_REWARD_INDEX' => '信誉奖励设置', 171 'PORTAL_REWARD_INDEX' => '信誉奖励设置',
171 'PORTAL_SHARE_CONTENT' => '分享内容管理', 172 'PORTAL_SHARE_CONTENT' => '分享内容管理',
172 'PORTAL_SHARE_DEFAULT' => '分享内容管理', 173 'PORTAL_SHARE_DEFAULT' => '分享内容管理',
173 'PORTAL_SHARE_PIC' => '图片管理', 174 'PORTAL_SHARE_PIC' => '图片管理',
174 - 'PORTAL_STATISTICS_INDEX' => '统计', 175 + 'PORTAL_STATISTICS_CASH' => '提现金额统计',
  176 + 'PORTAL_STATISTICS_DEFAULT' => '统计',
  177 + 'PORTAL_STATISTICS_ELSEMONEY' => '透视卡金额统计',
  178 + 'PORTAL_STATISTICS_GETMONEY' => '奖励金额统计',
  179 + 'PORTAL_STATISTICS_INDEX' => '注册统计',
  180 + 'PORTAL_STATISTICS_MONEY' => '缴纳金额统计',
175 'PORTAL_USERNEED_DEFAULT' => '发布需求管理', 181 'PORTAL_USERNEED_DEFAULT' => '发布需求管理',
176 'PORTAL_USERNEED_INDEX' => '保证金内容管理', 182 'PORTAL_USERNEED_INDEX' => '保证金内容管理',
177 'USER_ADMINASSET_DELETE' => '删除文件', 183 'USER_ADMINASSET_DELETE' => '删除文件',
@@ -796,7 +796,7 @@ function openUploadDialog(dialog_title, callback, extra_params, multi, filetype, @@ -796,7 +796,7 @@ function openUploadDialog(dialog_title, callback, extra_params, multi, filetype,
796 if (typeof callback == 'function') { 796 if (typeof callback == 'function') {
797 var iframewindow = this.iframe.contentWindow; 797 var iframewindow = this.iframe.contentWindow;
798 var files = iframewindow.get_selected_files(); 798 var files = iframewindow.get_selected_files();
799 - console.log(files); 799 + // console.log(files);
800 if (files && files.length > 0) { 800 if (files && files.length > 0) {
801 callback.apply(this, [this, files, extra_params]); 801 callback.apply(this, [this, files, extra_params]);
802 } else { 802 } else {
  1 +<include file="public@header"/>
  2 +<style type="text/css">
  3 + .pic-list li {
  4 + margin-bottom: 5px;
  5 + }
  6 +</style>
  7 +
  8 +<script type="text/html" id="files-item-tpl">
  9 + <li id="saved-file{id}">
  10 + <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
  11 + <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{filepath}"
  12 + style="width: 200px;" title="文件名称">
  13 + <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
  14 + </li>
  15 +</script>
  16 +</head>
  17 +<body>
  18 +<div class="wrap js-check-wrap">
  19 + <form action="{:url('Cooperation/video')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
  20 + <div class="row">
  21 + <div class="col-md-9">
  22 + <table class="table table-bordered">
  23 + <tr>
  24 + <th>附件</th>
  25 + <td>
  26 + <ul id="files" class="pic-list list-unstyled form-inline">
  27 +
  28 + <li id="saved-file1">
  29 + <input id="file-1" type="hidden" name="file_urls[]"
  30 + value="{$video.path}">
  31 + <input class="form-control" id="file-1-name" type="text"
  32 + name="file_names[]"
  33 + value="{$video.path}" style="width: 200px;" title="图片名称">
  34 + <a href="javascript:(function(){$('#saved-file1').remove();})();">移除</a>
  35 + </li>
  36 +
  37 + </ul>
  38 + <a href="javascript:uploadMultiFile('附件上传','#files','files-item-tpl','file');"
  39 + class="btn btn-sm btn-default">选择文件</a>
  40 + </td>
  41 + </tr>
  42 + </table>
  43 + </div>
  44 +
  45 + </div>
  46 + <div class="form-group">
  47 + <div class="col-sm-offset-2 col-sm-10">
  48 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
  49 + </div>
  50 + </div>
  51 + </form>
  52 +</div>
  53 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  54 +<script type="text/javascript">
  55 + //编辑器路径定义
  56 + var editorURL = GV.WEB_ROOT;
  57 +</script>
  58 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  59 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  60 +<script type="text/javascript">
  61 + $(function () {
  62 +
  63 + editorcontent = new baidu.editor.ui.Editor();
  64 + editorcontent.render('content');
  65 + try {
  66 + editorcontent.sync();
  67 + } catch (err) {
  68 + }
  69 +
  70 + $('.btn-cancel-thumbnail').click(function () {
  71 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  72 + $('#thumbnail').val('');
  73 + });
  74 +
  75 + $('#more-template-select').val("{$post.more.template|default=''}");
  76 + });
  77 +
  78 +</script>
  79 +
  80 +
  81 +
  82 +</body>
  83 +</html>
  1 +<include file="public@header"/>
  2 +<link rel="stylesheet" href="__STATIC__/install/css/mdialog.css">
  3 +<style>
  4 + .popup,.popdown{
  5 + width: 250px;
  6 + height: 100px;
  7 + background-color: rgba(0,0,0,0.5);
  8 + position: fixed;
  9 + top: 50%;
  10 + transform: translateY(-50px);
  11 + left: 0;
  12 + right: 0;
  13 + margin: 0 auto;
  14 + border-radius: 5px;
  15 + color: #ffffff;
  16 + }
  17 + .popup p,.popdown p{
  18 + text-align: center;
  19 + margin-top: 20px;
  20 + }
  21 + .popup span,.popdown span{
  22 + text-align: center;
  23 + line-height: 30px;
  24 + cursor: pointer;
  25 + }
  26 + .popup .queding,.popdown .sure{
  27 + display: inline-block;
  28 + width: 80px;
  29 + height: 30px;
  30 + background-color: #1E9FFF;
  31 + border-radius: 3px;
  32 + }
  33 + .popup span:hover,.popdown span:hover{
  34 + opacity: 0.8;
  35 + }
  36 + .popup .quxiao,.popdown .re{
  37 + display: inline-block;
  38 + width: 80px;
  39 + height: 30px;
  40 + ckground-color: #9cb945 ;
  41 + color: #333333;
  42 + border-radius: 3px;
  43 + background-color:#fff;
  44 + margin-left: 35px;
  45 + }
  46 + .btn_list{
  47 + margin: 0 auto;
  48 + width: 200px;
  49 + }
  50 +</style>
  51 +</head>
  52 +<body>
  53 +<div class="wrap">
  54 + <ul class="nav nav-tabs">
  55 + <li class="active"><a>投诉管理</a></li>
  56 + </ul>
  57 + <form class="well form-inline margin-top-20" method="post" action="{:url('Complaint/index')}">
  58 + 时间:
  59 + <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
  60 + value="{$start_time|default=''}"
  61 + style="width: 140px;" autocomplete="off"> -
  62 + <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
  63 + value="{$end_time|default=''}"
  64 + style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
  65 + 用户名:
  66 + <input type="text" class="form-control" name="name" style="width: 200px;"
  67 + value="{$name|default=''}" placeholder="请输入姓名">
  68 + 手机号:
  69 + <input type="text" class="form-control" name="tel" style="width: 200px;"
  70 + value="{$tel|default=''}" placeholder="请输入手机号">
  71 + <input type="submit" class="btn btn-primary" value="搜索"/>
  72 + <a class="btn btn-danger" href="{:url('Refund/index')}">清空</a>
  73 + <!--<span class="btn btn-default" onclick="window.history.back(-1)" >返回</span>-->
  74 + </form>
  75 +
  76 +
  77 + <form method="post" class="js-ajax-form margin-top-20">
  78 + <table class="table table-hover table-bordered">
  79 + <thead>
  80 + <tr>
  81 + <th>ID</th>
  82 + <th>用户id</th>
  83 + <th>用户名</th>
  84 + <th>手机号</th>
  85 + <th>类型</th>
  86 + <th>退款金额</th>
  87 + <th>退款单号</th>
  88 + <th>退款方式</th>
  89 + <th>退款原因</th>
  90 + <th>退款时间</th>
  91 + <th>退款成功时间</th>
  92 + <th>状态</th>
  93 + <!--<th>操作</th>-->
  94 + </tr>
  95 + </thead>
  96 + <tbody>
  97 + <foreach name="lists" item="vo">
  98 + <tr>
  99 + <td>{$vo.id}</td>
  100 + <td>{$vo.user_id}</td>
  101 + <td>{$vo.name}</td>
  102 + <td>{$vo.tel}</td>
  103 + <td>
  104 + <eq name="vo.user_type" value="1">
  105 + 用户
  106 + </eq>
  107 + <eq name="vo.user_type" value="2">
  108 + 中介
  109 + </eq>
  110 +
  111 + </td>
  112 + <td>{$vo.money}</td>
  113 + <td>{$vo.refund_id}</td>
  114 + <td>
  115 + <eq name="vo.pay_type" value="1">
  116 + 支付宝
  117 + </eq>
  118 + <eq name="vo.pay_type" value="2">
  119 + 微信
  120 + </eq>
  121 + </td>
  122 + <td>
  123 + <eq name="vo.reason" value="1">
  124 + 报价人数不足
  125 + </eq>
  126 + <eq name="vo.reason" value="2">
  127 + 用户未选择
  128 + </eq>
  129 + <eq name="vo.reason" value="3">
  130 + 用户未确认
  131 + </eq>
  132 + <eq name="vo.reason" value="4">
  133 + 中介未确认
  134 + </eq>
  135 + </td>
  136 + <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
  137 + <td>{:date('Y-m-d H:i:s',$vo['refund_time'])}</td>
  138 + <td>
  139 + <eq name="vo.status" value="1">
  140 + <span index="{$vo.id}" style="color: #858585">退款处理中</span>
  141 + </eq>
  142 + <eq name="vo.status" value="2">
  143 + <span index="{$vo.id}" style="color: #858585">退款成功</span>
  144 + </eq>
  145 + <eq name="vo.status" value="3">
  146 + <span index="{$vo.id}" style="color: #858585">退款关闭</span>
  147 + </eq>
  148 + <eq name="vo.status" value="4">
  149 + <span index="{$vo.id}" style="color: #858585">退款异常</span>
  150 + </eq>
  151 + </td>
  152 +
  153 + </tr>
  154 + </foreach>
  155 +
  156 + </tbody>
  157 +
  158 + </table>
  159 + <ul class="pagination">{$page|default=''}</ul>
  160 + </form>
  161 +
  162 +</div>
  163 +<script src="__STATIC__/js/admin.js"></script>
  164 +<script src="__STATIC__/js/layer/layer.js"></script>
  165 +<script type="text/javascript" src="__STATIC__/js/zepto.min.js"></script>
  166 +<script type="text/javascript" src="__STATIC__/js/mdialog.js"></script>
  167 +<script type="">
  168 +
  169 +
  170 +</script>
  171 +</body>
  172 +</html>
  1 +<include file="public@header"/>
  2 +<meta charset="utf-8">
  3 +<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
  4 +<meta name="viewport" content="width=device-width, initial-scale=1">
  5 +<style>
  6 + /* css 代码 */
  7 +</style>
  8 +<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
  9 +<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
  10 +<script src="__STATIC__/js/highcharts.js"></script>
  11 +</head>
  12 +<body>
  13 +<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
  14 + <div class="well form-inline margin-top-20" >
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off">
  22 + <input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
  23 + <a class="btn btn-danger" href="{:url('Statistics/cash')}">清空</a>
  24 + </div>
  25 +</div>
  26 +<div id="container" style="min-width:400px;height:400px">
  27 +
  28 +</div>
  29 +<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
  30 +<script src="__STATIC__/js/admin.js"></script>
  31 +<script>
  32 + function all() {
  33 + var timeList=[];
  34 + var _user=[] ;
  35 + var _member=[] ;
  36 + var chart ;
  37 + var pie_user ;
  38 + var pie_member ;
  39 + var start_time = $('.start_time').val();
  40 + var end_time = $('.end_time').val();
  41 + function GetDateStr(AddDayCount) {
  42 + var dd = new Date();
  43 + dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
  44 + var y = dd.getFullYear();
  45 + var m = dd.getMonth()+1;//获取当前月份的日期
  46 + var d = dd.getDate();
  47 + return y+"-"+m+"-"+d;
  48 + }
  49 + for(var i=-4;i<1;i++){
  50 + timeList.push(GetDateStr(i))
  51 + }
  52 + getData();
  53 + function getData(){
  54 + $.ajax({
  55 + type:"POST",
  56 + url:"{:url('portal/Statistics/findcash')}",
  57 + data:{
  58 + "time":timeList,
  59 + "start_time":start_time,
  60 + "end_time":end_time,
  61 + },
  62 + success:function (data) {
  63 + console.log(data)
  64 + _user = Object.assign([],data.data.user);
  65 + _member = Object.assign([],data.data.member);
  66 + pie_user = data.data.pie_user;
  67 + pie_member = data.data.pie_member;
  68 + // 图表
  69 + chart = Highcharts.chart('container', {
  70 + title: {
  71 + text: '注册统计图表'
  72 + },
  73 + xAxis: {
  74 + categories: timeList,
  75 + crosshair: true
  76 + },
  77 + plotOptions: {
  78 + column: {
  79 + pointPadding: 0,
  80 + borderWidth: 0
  81 + }
  82 + },
  83 + labels: {
  84 + items: [{
  85 + html: '即时数据/筛选结果',
  86 + style: {
  87 + left: '100px',
  88 + top: '18px',
  89 + color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
  90 + }
  91 + }]
  92 + },
  93 + tooltip :{
  94 + headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  95 + pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  96 + '<td style="padding:0"><b>{point.y:.0f} 元</b></td></tr>',
  97 + footerFormat: '</table>',
  98 + shared: true,
  99 + useHTML: true
  100 + },
  101 + series: [{
  102 + type: 'column',
  103 + name: '用户',
  104 + data: _user
  105 + }, {
  106 + type: 'column',
  107 + name: '中介',
  108 + data: _member
  109 + }, {
  110 + type: 'pie',
  111 + name: '注册人数',
  112 + data: [{
  113 + name: '中介',
  114 + y: pie_member,
  115 + color: Highcharts.getOptions().colors[1] // Jane's color
  116 + }, {
  117 + name: '用户',
  118 + y: pie_user,
  119 + color: Highcharts.getOptions().colors[0] // John's color
  120 + }],
  121 + center: [100, 80],
  122 + size: 100,
  123 + showInLegend: false,
  124 + dataLabels: {
  125 + enabled: false
  126 + }
  127 + }]
  128 + });
  129 + },
  130 + error:function () {
  131 + alert("网络错误");
  132 + }
  133 + })
  134 + }
  135 + }
  136 + // 请求获取数据
  137 +
  138 +
  139 +
  140 + all();
  141 + $('.btn').click(function () {
  142 + all();
  143 + })
  144 +</script>
  145 +</body>
  146 +</html>
  1 +<include file="public@header"/>
  2 +<meta charset="utf-8">
  3 +<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
  4 +<meta name="viewport" content="width=device-width, initial-scale=1">
  5 +<style>
  6 + /* css 代码 */
  7 +</style>
  8 +<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
  9 +<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
  10 +<script src="__STATIC__/js/highcharts.js"></script>
  11 +</head>
  12 +<body>
  13 +<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
  14 + <div class="well form-inline margin-top-20" >
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off">
  22 + <input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
  23 + <a class="btn btn-danger" href="{:url('Statistics/elseMoney')}">清空</a>
  24 + </div>
  25 +</div>
  26 +<div id="container" style="min-width:400px;height:400px">
  27 +
  28 +</div>
  29 +<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
  30 +<script src="__STATIC__/js/admin.js"></script>
  31 +<script>
  32 + function all() {
  33 + var timeList=[];
  34 + var _user=[] ;
  35 + var _member=[] ;
  36 + var chart ;
  37 + var pie_user ;
  38 + var pie_member ;
  39 + var start_time = $('.start_time').val();
  40 + var end_time = $('.end_time').val();
  41 + function GetDateStr(AddDayCount) {
  42 + var dd = new Date();
  43 + dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
  44 + var y = dd.getFullYear();
  45 + var m = dd.getMonth()+1;//获取当前月份的日期
  46 + var d = dd.getDate();
  47 + return y+"-"+m+"-"+d;
  48 + }
  49 + for(var i=-4;i<1;i++){
  50 + timeList.push(GetDateStr(i))
  51 + }
  52 + getData();
  53 + function getData(){
  54 + $.ajax({
  55 + type:"POST",
  56 + url:"{:url('portal/Statistics/findelse')}",
  57 + data:{
  58 + "time":timeList,
  59 + "start_time":start_time,
  60 + "end_time":end_time,
  61 + },
  62 + success:function (data) {
  63 + console.log(data)
  64 + _user = Object.assign([],data.data.user);
  65 + _member = Object.assign([],data.data.member);
  66 + pie_user = data.data.pie_user;
  67 + pie_member = data.data.pie_member;
  68 + // 图表
  69 + chart = Highcharts.chart('container', {
  70 + title: {
  71 + text: '注册统计图表'
  72 + },
  73 + xAxis: {
  74 + categories: timeList,
  75 + crosshair: true
  76 + },
  77 + plotOptions: {
  78 + column: {
  79 + pointPadding: 0,
  80 + borderWidth: 0
  81 + }
  82 + },
  83 + labels: {
  84 + items: [{
  85 + html: '即时数据/筛选结果',
  86 + style: {
  87 + left: '100px',
  88 + top: '18px',
  89 + color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
  90 + }
  91 + }]
  92 + },
  93 + tooltip :{
  94 + headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  95 + pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  96 + '<td style="padding:0"><b>{point.y:.0f} 人</b></td></tr>',
  97 + footerFormat: '</table>',
  98 + shared: true,
  99 + useHTML: true
  100 + },
  101 + series: [{
  102 + type: 'column',
  103 + name: '用户',
  104 + data: _user
  105 + }, {
  106 + type: 'column',
  107 + name: '中介',
  108 + data: _member
  109 + }, {
  110 + type: 'pie',
  111 + name: '注册人数',
  112 + data: [{
  113 + name: '中介',
  114 + y: pie_member,
  115 + color: Highcharts.getOptions().colors[1] // Jane's color
  116 + }, {
  117 + name: '用户',
  118 + y: pie_user,
  119 + color: Highcharts.getOptions().colors[0] // John's color
  120 + }],
  121 + center: [100, 80],
  122 + size: 100,
  123 + showInLegend: false,
  124 + dataLabels: {
  125 + enabled: false
  126 + }
  127 + }]
  128 + });
  129 + },
  130 + error:function () {
  131 + alert("网络错误");
  132 + }
  133 + })
  134 + }
  135 + }
  136 + // 请求获取数据
  137 +
  138 +
  139 +
  140 + all();
  141 + $('.btn').click(function () {
  142 + all();
  143 + })
  144 +</script>
  145 +</body>
  146 +</html>
  1 +<include file="public@header"/>
  2 +<meta charset="utf-8">
  3 +<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
  4 +<meta name="viewport" content="width=device-width, initial-scale=1">
  5 +<style>
  6 + /* css 代码 */
  7 +</style>
  8 +<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
  9 +<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
  10 +<script src="__STATIC__/js/highcharts.js"></script>
  11 +</head>
  12 +<body>
  13 +<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
  14 + <div class="well form-inline margin-top-20" >
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off">
  22 + <input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
  23 + <a class="btn btn-danger" href="{:url('Statistics/getmoney')}">清空</a>
  24 + </div>
  25 +</div>
  26 +<div id="container" style="min-width:400px;height:400px">
  27 +
  28 +</div>
  29 +<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
  30 +<script src="__STATIC__/js/admin.js"></script>
  31 +<script>
  32 + function all() {
  33 + var timeList=[];
  34 + var _user=[] ;
  35 + var _member=[] ;
  36 + var chart ;
  37 + var pie_user ;
  38 + var pie_member ;
  39 + var start_time = $('.start_time').val();
  40 + var end_time = $('.end_time').val();
  41 + function GetDateStr(AddDayCount) {
  42 + var dd = new Date();
  43 + dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
  44 + var y = dd.getFullYear();
  45 + var m = dd.getMonth()+1;//获取当前月份的日期
  46 + var d = dd.getDate();
  47 + return y+"-"+m+"-"+d;
  48 + }
  49 + for(var i=-4;i<1;i++){
  50 + timeList.push(GetDateStr(i))
  51 + }
  52 + getData();
  53 + function getData(){
  54 + $.ajax({
  55 + type:"POST",
  56 + url:"{:url('portal/Statistics/findgetmoney')}",
  57 + data:{
  58 + "time":timeList,
  59 + "start_time":start_time,
  60 + "end_time":end_time,
  61 + },
  62 + success:function (data) {
  63 + console.log(data)
  64 + _user = Object.assign([],data.data.user);
  65 + _member = Object.assign([],data.data.member);
  66 + pie_user = data.data.pie_user;
  67 + pie_member = data.data.pie_member;
  68 + // 图表
  69 + chart = Highcharts.chart('container', {
  70 + title: {
  71 + text: '注册统计图表'
  72 + },
  73 + xAxis: {
  74 + categories: timeList,
  75 + crosshair: true
  76 + },
  77 + plotOptions: {
  78 + column: {
  79 + pointPadding: 0,
  80 + borderWidth: 0
  81 + }
  82 + },
  83 + labels: {
  84 + items: [{
  85 + html: '即时数据/筛选结果',
  86 + style: {
  87 + left: '100px',
  88 + top: '18px',
  89 + color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
  90 + }
  91 + }]
  92 + },
  93 + tooltip :{
  94 + headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  95 + pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  96 + '<td style="padding:0"><b>{point.y:.0f} 元</b></td></tr>',
  97 + footerFormat: '</table>',
  98 + shared: true,
  99 + useHTML: true
  100 + },
  101 + series: [{
  102 + type: 'column',
  103 + name: '用户',
  104 + data: _user
  105 + }, {
  106 + type: 'column',
  107 + name: '中介',
  108 + data: _member
  109 + }, {
  110 + type: 'pie',
  111 + name: '注册人数',
  112 + data: [{
  113 + name: '中介',
  114 + y: pie_member,
  115 + color: Highcharts.getOptions().colors[1] // Jane's color
  116 + }, {
  117 + name: '用户',
  118 + y: pie_user,
  119 + color: Highcharts.getOptions().colors[0] // John's color
  120 + }],
  121 + center: [100, 80],
  122 + size: 100,
  123 + showInLegend: false,
  124 + dataLabels: {
  125 + enabled: false
  126 + }
  127 + }]
  128 + });
  129 + },
  130 + error:function () {
  131 + alert("网络错误");
  132 + }
  133 + })
  134 + }
  135 + }
  136 + // 请求获取数据
  137 +
  138 +
  139 +
  140 + all();
  141 + $('.btn').click(function () {
  142 + all();
  143 + })
  144 +</script>
  145 +</body>
  146 +</html>
  1 +<include file="public@header"/>
  2 +<meta charset="utf-8">
  3 +<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
  4 +<meta name="viewport" content="width=device-width, initial-scale=1">
  5 +<style>
  6 + /* css 代码 */
  7 +</style>
  8 +<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
  9 +<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
  10 +<script src="__STATIC__/js/highcharts.js"></script>
  11 +</head>
  12 +<body>
  13 +<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
  14 + <div class="well form-inline margin-top-20" >
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off">
  22 + 状态:
  23 + <select name="status" style="border: 1px solid #dce4ec; margin-top: 20px;" class="type">
  24 + <option name="status" value="0" >&nbsp; &nbsp;---请选择---</option>
  25 + <option name="status" value="1">进行中</option>
  26 + <option name="status" value="2">已成交</option>
  27 +
  28 +
  29 + </select>
  30 + &nbsp;&nbsp;&nbsp;&nbsp;
  31 + <input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
  32 + <a class="btn btn-danger" href="{:url('Statistics/money')}">清空</a>
  33 + </div>
  34 +</div>
  35 +<div id="container" style="min-width:400px;height:400px">
  36 +
  37 +</div>
  38 +<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
  39 +<script src="__STATIC__/js/admin.js"></script>
  40 +<script>
  41 + function all() {
  42 + var timeList=[];
  43 + var _user=[] ;
  44 + var _member=[] ;
  45 + var chart ;
  46 + var pie_user ;
  47 + var pie_member ;
  48 + var pie_all ;
  49 + var start_time = $('.start_time').val();
  50 + var end_time = $('.end_time').val();
  51 + var status = $('.type').val();
  52 + function GetDateStr(AddDayCount) {
  53 + var dd = new Date();
  54 + dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
  55 + var y = dd.getFullYear();
  56 + var m = dd.getMonth()+1;//获取当前月份的日期
  57 + var d = dd.getDate();
  58 + return y+"-"+m+"-"+d;
  59 + }
  60 + for(var i=-4;i<1;i++){
  61 + timeList.push(GetDateStr(i))
  62 + }
  63 + getData();
  64 + function getData(){
  65 + $.ajax({
  66 + type:"POST",
  67 + url:"{:url('portal/Statistics/findmoney')}",
  68 + data:{
  69 + "time":timeList,
  70 + "start_time":start_time,
  71 + "end_time":end_time,
  72 + "status":status,
  73 + },
  74 + success:function (data) {
  75 + console.log(data)
  76 + _user = Object.assign([],data.data.user);
  77 + _member = Object.assign([],data.data.member);
  78 + pie_user = data.data.pie_user;
  79 + pie_member = data.data.pie_member;
  80 + pie_all = data.data.pie_member + data.data.pie_user;
  81 + // 图表
  82 + chart = Highcharts.chart('container', {
  83 + title: {
  84 + text: '注册统计图表'
  85 + },
  86 + xAxis: {
  87 + categories: timeList,
  88 + crosshair: true
  89 + },
  90 + plotOptions: {
  91 + column: {
  92 + pointPadding: 0,
  93 + borderWidth: 0
  94 + }
  95 + },
  96 + labels: {
  97 + items: [{
  98 + html: "即时数据/筛选结果(共"+pie_all+"元)",
  99 + style: {
  100 + left: '100px',
  101 + top: '18px',
  102 + color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
  103 + }
  104 + }]
  105 + },
  106 + tooltip :{
  107 + headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  108 + pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  109 + '<td style="padding:0"><b>{point.y:.0f} 元</b></td></tr>',
  110 + footerFormat: '</table>',
  111 + shared: true,
  112 + useHTML: true
  113 + },
  114 + series: [{
  115 + type: 'column',
  116 + name: '用户',
  117 + data: _user
  118 + }, {
  119 + type: 'column',
  120 + name: '中介',
  121 + data: _member
  122 + }, {
  123 + type: 'pie',
  124 + name: '注册人数',
  125 + data: [{
  126 + name: '中介',
  127 + y: pie_member,
  128 + color: Highcharts.getOptions().colors[1] // Jane's color
  129 + }, {
  130 + name: '用户',
  131 + y: pie_user,
  132 + color: Highcharts.getOptions().colors[0] // John's color
  133 + }],
  134 + center: [100, 80],
  135 + size: 100,
  136 + showInLegend: false,
  137 + dataLabels: {
  138 + enabled: false
  139 + }
  140 + }]
  141 + });
  142 + },
  143 + error:function () {
  144 + alert("网络错误");
  145 + }
  146 + })
  147 + }
  148 + }
  149 + // 请求获取数据
  150 +
  151 +
  152 +
  153 + all();
  154 + $('.btn').click(function () {
  155 + all();
  156 + })
  157 +</script>
  158 +</body>
  159 +</html>
@@ -42,6 +42,16 @@ @@ -42,6 +42,16 @@
42 </td> 42 </td>
43 </tr> 43 </tr>
44 <tr> 44 <tr>
  45 + <th width="15%">中介报价次数</th>
  46 + <td><input class="form-control" type="text" name="count_agency" value="{$list['count_agency']}" />
  47 + </td>
  48 + </tr>
  49 + <tr>
  50 + <th width="15%">中介已中标次数</th>
  51 + <td><input class="form-control" type="text" name="count_deal" value="{$list['count_deal']}" />
  52 + </td>
  53 + </tr>
  54 + <tr>
45 <th width="15%">城市</th> 55 <th width="15%">城市</th>
46 <td><input class="form-control" type="text" name="city" value="{$list['city']}" /> 56 <td><input class="form-control" type="text" name="city" value="{$list['city']}" />
47 </td> 57 </td>
@@ -684,12 +684,12 @@ @@ -684,12 +684,12 @@
684 uploader.on('uploadError', function (file, reason) { 684 uploader.on('uploadError', function (file, reason) {
685 console.log(file.id); 685 console.log(file.id);
686 console.log(reason); 686 console.log(reason);
  687 +
687 if (reason == 'server') { 688 if (reason == 'server') {
688 $('#' + file.id).find('p.error').text(fileErrorMsg[file.id]); 689 $('#' + file.id).find('p.error').text(fileErrorMsg[file.id]);
689 } 690 }
690 691
691 }); 692 });
692 -  
693 uploader.onError = function (code) { 693 uploader.onError = function (code) {
694 switch (code) { 694 switch (code) {
695 case "Q_TYPE_DENIED": 695 case "Q_TYPE_DENIED":
@@ -1282,3 +1282,7 @@ @@ -1282,3 +1282,7 @@
1282 2018-07-24 16:19:28 response: '<form id=\'alipaysubmit\' name=\'alipaysubmit\' action=\'https://openapi.alipay.com/gateway.do?charset=UTF-8\' method=\'POST\'><input type=\'hidden\' name=\'biz_content\' value=\'{"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072199481015"}\'/><input type=\'hidden\' name=\'app_id\' value=\'2018062560425105\'/><input type=\'hidden\' name=\'version\' value=\'1.0\'/><input type=\'hidden\' name=\'format\' value=\'json\'/><input type=\'hidden\' name=\'sign_type\' value=\'RSA2\'/><input type=\'hidden\' name=\'method\' value=\'alipay.trade.page.pay\'/><input type=\'hidden\' name=\'timestamp\' value=\'2018-07-24 16:19:28\'/><input type=\'hidden\' name=\'alipay_sdk\' value=\'alipay-sdk-php-20161101\'/><input type=\'hidden\' name=\'notify_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/notify_url\'/><input type=\'hidden\' name=\'return_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/return_url\'/><input type=\'hidden\' name=\'charset\' value=\'UTF-8\'/><input type=\'hidden\' name=\'sign\' value=\'wM7VQXlL8ov5HFZ4BLFkc0uZ3V9wFl1+zuHqa3r3tTCwi7BRMDc6qv1NuA7mCz+hH/5krUrdcxo1Sx+U8WTIFctFYUZymo73u7MwxaqavqEF9h1+eZpQ8hMUCgAont3glbYQwZZE7hbQObnQFxtr1Ox56mbF7SyyOQ6srtoptIQo3r4XOrucJSxmxazqEBZSjP3Wb7YUPr7zFUIF3hgRxhhkEDB7+XD8kK1w2i/5LSKdR8TkEAf6jN3RL05rR49vd11OSS3lPYreANgSvtRaXGiyOye7R1hXN/oZgYws9jFw9Eu4YyNw/aqRkI+p11LUZAPhWUoRB3/5ehNJFh6LKg==\'/><input type=\'submit\' value=\'ok\' style=\'display:none;\'\'></form><script>document.forms[\'alipaysubmit\'].submit();</script>' 1282 2018-07-24 16:19:28 response: '<form id=\'alipaysubmit\' name=\'alipaysubmit\' action=\'https://openapi.alipay.com/gateway.do?charset=UTF-8\' method=\'POST\'><input type=\'hidden\' name=\'biz_content\' value=\'{"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072199481015"}\'/><input type=\'hidden\' name=\'app_id\' value=\'2018062560425105\'/><input type=\'hidden\' name=\'version\' value=\'1.0\'/><input type=\'hidden\' name=\'format\' value=\'json\'/><input type=\'hidden\' name=\'sign_type\' value=\'RSA2\'/><input type=\'hidden\' name=\'method\' value=\'alipay.trade.page.pay\'/><input type=\'hidden\' name=\'timestamp\' value=\'2018-07-24 16:19:28\'/><input type=\'hidden\' name=\'alipay_sdk\' value=\'alipay-sdk-php-20161101\'/><input type=\'hidden\' name=\'notify_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/notify_url\'/><input type=\'hidden\' name=\'return_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/return_url\'/><input type=\'hidden\' name=\'charset\' value=\'UTF-8\'/><input type=\'hidden\' name=\'sign\' value=\'wM7VQXlL8ov5HFZ4BLFkc0uZ3V9wFl1+zuHqa3r3tTCwi7BRMDc6qv1NuA7mCz+hH/5krUrdcxo1Sx+U8WTIFctFYUZymo73u7MwxaqavqEF9h1+eZpQ8hMUCgAont3glbYQwZZE7hbQObnQFxtr1Ox56mbF7SyyOQ6srtoptIQo3r4XOrucJSxmxazqEBZSjP3Wb7YUPr7zFUIF3hgRxhhkEDB7+XD8kK1w2i/5LSKdR8TkEAf6jN3RL05rR49vd11OSS3lPYreANgSvtRaXGiyOye7R1hXN/oZgYws9jFw9Eu4YyNw/aqRkI+p11LUZAPhWUoRB3/5ehNJFh6LKg==\'/><input type=\'submit\' value=\'ok\' style=\'display:none;\'\'></form><script>document.forms[\'alipaysubmit\'].submit();</script>'
1283 2018-07-25 15:41:51 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072556535456"} 1283 2018-07-25 15:41:51 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072556535456"}
1284 2018-07-25 15:41:51 response: '<form id=\'alipaysubmit\' name=\'alipaysubmit\' action=\'https://openapi.alipay.com/gateway.do?charset=UTF-8\' method=\'POST\'><input type=\'hidden\' name=\'biz_content\' value=\'{"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072556535456"}\'/><input type=\'hidden\' name=\'app_id\' value=\'2018062560425105\'/><input type=\'hidden\' name=\'version\' value=\'1.0\'/><input type=\'hidden\' name=\'format\' value=\'json\'/><input type=\'hidden\' name=\'sign_type\' value=\'RSA2\'/><input type=\'hidden\' name=\'method\' value=\'alipay.trade.page.pay\'/><input type=\'hidden\' name=\'timestamp\' value=\'2018-07-25 15:41:51\'/><input type=\'hidden\' name=\'alipay_sdk\' value=\'alipay-sdk-php-20161101\'/><input type=\'hidden\' name=\'notify_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/notify_url\'/><input type=\'hidden\' name=\'return_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/return_url\'/><input type=\'hidden\' name=\'charset\' value=\'UTF-8\'/><input type=\'hidden\' name=\'sign\' value=\'ASt3s4pu9rBbcNefAqZJlYPA19fo1+EthrchZ3cwUHdOku2j1j0pDOTxC14qlVKGFoRqXwuwROoadTLiT0YYEFPgWOuCk3Am3dR3T6rA150tJwHGAzJzP/VqDnsGe14U+jYOIut/SE96sAIg2OpZeoM5npIhx4Qhf906L9qecYzrM9QDuAqaNue9UzOVHioeeibsw5CxjxBIc5WcXH+BgYdByhcGVoqYoWJPgMTp+Es1VDq/kDchzqjYSRHRg6hFbDpinJEnVQwjBPEW0TZg82p2n8lZUO7HG4qI6ynXKm5KVNMecbm6YyhJTT8gBOxk0YOjAadkbA/leX1QSq/rFQ==\'/><input type=\'submit\' value=\'ok\' style=\'display:none;\'\'></form><script>document.forms[\'alipaysubmit\'].submit();</script>' 1284 2018-07-25 15:41:51 response: '<form id=\'alipaysubmit\' name=\'alipaysubmit\' action=\'https://openapi.alipay.com/gateway.do?charset=UTF-8\' method=\'POST\'><input type=\'hidden\' name=\'biz_content\' value=\'{"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072556535456"}\'/><input type=\'hidden\' name=\'app_id\' value=\'2018062560425105\'/><input type=\'hidden\' name=\'version\' value=\'1.0\'/><input type=\'hidden\' name=\'format\' value=\'json\'/><input type=\'hidden\' name=\'sign_type\' value=\'RSA2\'/><input type=\'hidden\' name=\'method\' value=\'alipay.trade.page.pay\'/><input type=\'hidden\' name=\'timestamp\' value=\'2018-07-25 15:41:51\'/><input type=\'hidden\' name=\'alipay_sdk\' value=\'alipay-sdk-php-20161101\'/><input type=\'hidden\' name=\'notify_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/notify_url\'/><input type=\'hidden\' name=\'return_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/return_url\'/><input type=\'hidden\' name=\'charset\' value=\'UTF-8\'/><input type=\'hidden\' name=\'sign\' value=\'ASt3s4pu9rBbcNefAqZJlYPA19fo1+EthrchZ3cwUHdOku2j1j0pDOTxC14qlVKGFoRqXwuwROoadTLiT0YYEFPgWOuCk3Am3dR3T6rA150tJwHGAzJzP/VqDnsGe14U+jYOIut/SE96sAIg2OpZeoM5npIhx4Qhf906L9qecYzrM9QDuAqaNue9UzOVHioeeibsw5CxjxBIc5WcXH+BgYdByhcGVoqYoWJPgMTp+Es1VDq/kDchzqjYSRHRg6hFbDpinJEnVQwjBPEW0TZg82p2n8lZUO7HG4qI6ynXKm5KVNMecbm6YyhJTT8gBOxk0YOjAadkbA/leX1QSq/rFQ==\'/><input type=\'submit\' value=\'ok\' style=\'display:none;\'\'></form><script>document.forms[\'alipaysubmit\'].submit();</script>'
  1285 +2018-07-31 14:32:48 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018073199499949"}
  1286 +2018-07-31 14:32:48 response: '<form id=\'alipaysubmit\' name=\'alipaysubmit\' action=\'https://openapi.alipay.com/gateway.do?charset=UTF-8\' method=\'POST\'><input type=\'hidden\' name=\'biz_content\' value=\'{"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018073199499949"}\'/><input type=\'hidden\' name=\'app_id\' value=\'2018062560425105\'/><input type=\'hidden\' name=\'version\' value=\'1.0\'/><input type=\'hidden\' name=\'format\' value=\'json\'/><input type=\'hidden\' name=\'sign_type\' value=\'RSA2\'/><input type=\'hidden\' name=\'method\' value=\'alipay.trade.page.pay\'/><input type=\'hidden\' name=\'timestamp\' value=\'2018-07-31 14:32:48\'/><input type=\'hidden\' name=\'alipay_sdk\' value=\'alipay-sdk-php-20161101\'/><input type=\'hidden\' name=\'notify_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/notify_url\'/><input type=\'hidden\' name=\'return_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/return_url\'/><input type=\'hidden\' name=\'charset\' value=\'UTF-8\'/><input type=\'hidden\' name=\'sign\' value=\'0WA2cDgb8co4l+8Xlwh6YsYpqNgqCHSCGzb0nV5mSRSjJrzVGXFL+SF6X5fH47JOjc3KvpdP5eJnXQJPGZeY09SInp3TtbUU4sTdQMzyiuJH7XUSTGbSRLRkjNGLpzDSy53yca8FsB91rPX9LpVm9xoMFrCHnNj2hL01kf0sIGWkxTBj8JYSCF/k1QNJUXkG52L37trSpoKFhRfvbWQWaQyIC0gJOmuwCgVW35TdQQdtINDN+ueqVBhvi2gOWnG/MPZ37xyDt9ao5QVgv7GflhoAkoYy4nwaebbf94+hJEvpvqUo1P8Apxz86p4C7lpZD2EDHgbGKOU/oEyqK0gBMw==\'/><input type=\'submit\' value=\'ok\' style=\'display:none;\'\'></form><script>document.forms[\'alipaysubmit\'].submit();</script>'
  1287 +2018-07-31 14:33:04 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018073199499949"}
  1288 +2018-07-31 14:33:04 response: '<form id=\'alipaysubmit\' name=\'alipaysubmit\' action=\'https://openapi.alipay.com/gateway.do?charset=UTF-8\' method=\'POST\'><input type=\'hidden\' name=\'biz_content\' value=\'{"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018073199499949"}\'/><input type=\'hidden\' name=\'app_id\' value=\'2018062560425105\'/><input type=\'hidden\' name=\'version\' value=\'1.0\'/><input type=\'hidden\' name=\'format\' value=\'json\'/><input type=\'hidden\' name=\'sign_type\' value=\'RSA2\'/><input type=\'hidden\' name=\'method\' value=\'alipay.trade.page.pay\'/><input type=\'hidden\' name=\'timestamp\' value=\'2018-07-31 14:33:04\'/><input type=\'hidden\' name=\'alipay_sdk\' value=\'alipay-sdk-php-20161101\'/><input type=\'hidden\' name=\'notify_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/notify_url\'/><input type=\'hidden\' name=\'return_url\' value=\'http://houseprice.w.bronet.cn/api/portal/Alipay/return_url\'/><input type=\'hidden\' name=\'charset\' value=\'UTF-8\'/><input type=\'hidden\' name=\'sign\' value=\'HhWAyCFPaGvXy2QzYmUBcoTBmtHkdN2o4J0jMzQha3KAwRtKMX4Zsj/iUheIjXxTUXVNdOkrnrpLu/fgZcJR+7ZKRL6qJxrGVv8rxEOPsyniZ8IBdyrz0SbJkHmWZsBj2GJ1zz4N0oRCJiiqrBe9I5Yg75Hz6Gqpr+owiq/ESzLYruuK5vis6JMPScB7bukijvdDxSuNmXkAclfBNBzxVAokHKmRl5Q6dJR9NH4eyossHbmXtnnd/jARotx7I4a4Riy07IZ8iYg5KzqyP8HSSLOXRVsAIWcdt18LAasdmgMYxSklUW191Zdkck2sKXcrfWmqo27t5kpaxXB/o2ma5w==\'/><input type=\'submit\' value=\'ok\' style=\'display:none;\'\'></form><script>document.forms[\'alipaysubmit\'].submit();</script>'
@@ -65,7 +65,7 @@ class SmsDemo @@ -65,7 +65,7 @@ class SmsDemo
65 } 65 }
66 66
67 /** 67 /**
68 - * 发送短信 68 + * 发送短信,验证码
69 * @return stdClass 69 * @return stdClass
70 */ 70 */
71 public static function sendSms($tel,$modelCode,$modelVal) { 71 public static function sendSms($tel,$modelCode,$modelVal) {
@@ -101,11 +101,49 @@ class SmsDemo @@ -101,11 +101,49 @@ class SmsDemo
101 return $acsResponse; 101 return $acsResponse;
102 } 102 }
103 103
  104 +
  105 + /**
  106 + * 发送短信,中介中标
  107 + * @return stdClass
  108 + */
  109 + public static function sendSmsAgency($tel,$modelVal) {
  110 + // 初始化SendSmsRequest实例用于设置发送短信的参数
  111 + $request = new SendSmsRequest();
  112 +
  113 + //可选-启用https协议
  114 + //$request->setProtocol("https");
  115 +
  116 + // 必填,设置短信接收号码
  117 + $request->setPhoneNumbers($tel);
  118 +
  119 + // 必填,设置签名名称,应严格按"签名名称"填写,请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/sign
  120 + $request->setSignName("比房价");
  121 +
  122 + // 必填,设置模板CODE,应严格按"模板CODE"填写, 请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/template
  123 + $request->setTemplateCode('SMS_137960210');
  124 +
  125 + // 可选,设置模板参数, 假如模板中存在变量需要替换则为必填项
  126 + $request->setTemplateParam(json_encode(array( // 短信模板中字段的值
  127 + "name"=>$modelVal,
  128 + ), JSON_UNESCAPED_UNICODE));
  129 +
  130 + // 可选,设置流水号
  131 +// $request->setOutId("yourOutId");
  132 +
  133 + // 选填,上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
  134 +// $request->setSmsUpExtendCode("1234567");
  135 +
  136 + // 发起访问请求
  137 + $acsResponse = static::getAcsClient()->getAcsResponse($request);
  138 +
  139 + return $acsResponse;
  140 + }
  141 +
104 /** 142 /**
105 * 批量发送短信 143 * 批量发送短信
106 * @return stdClass 144 * @return stdClass
107 */ 145 */
108 - public static function sendBatchSms() { 146 + public static function sendBatchSms($tel,$code,$content,$autograph) {
109 147
110 // 初始化SendSmsRequest实例用于设置发送短信的参数 148 // 初始化SendSmsRequest实例用于设置发送短信的参数
111 $request = new SendBatchSmsRequest(); 149 $request = new SendBatchSmsRequest();
@@ -114,32 +152,20 @@ class SmsDemo @@ -114,32 +152,20 @@ class SmsDemo
114 //$request->setProtocol("https"); 152 //$request->setProtocol("https");
115 153
116 // 必填:待发送手机号。支持JSON格式的批量调用,批量上限为100个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式 154 // 必填:待发送手机号。支持JSON格式的批量调用,批量上限为100个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
117 - $request->setPhoneNumberJson(json_encode(array(  
118 - "1500000000",  
119 - "1500000001",  
120 - ), JSON_UNESCAPED_UNICODE)); 155 + $request->setPhoneNumberJson($tel);
121 156
122 // 必填:短信签名-支持不同的号码发送不同的短信签名 157 // 必填:短信签名-支持不同的号码发送不同的短信签名
123 $request->setSignNameJson(json_encode(array( 158 $request->setSignNameJson(json_encode(array(
124 - "云通信",  
125 - "云通信" 159 + "比房价",
  160 + "比房价"
126 ), JSON_UNESCAPED_UNICODE)); 161 ), JSON_UNESCAPED_UNICODE));
127 162
128 // 必填:短信模板-可在短信控制台中找到 163 // 必填:短信模板-可在短信控制台中找到
129 - $request->setTemplateCode("SMS_1000000"); 164 + $request->setTemplateCode($code);
130 165
131 // 必填:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 166 // 必填:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
132 // 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败 167 // 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
133 - $request->setTemplateParamJson(json_encode(array(  
134 - array(  
135 - "name" => "Tom",  
136 - "code" => "123",  
137 - ),  
138 - array(  
139 - "name" => "Jack",  
140 - "code" => "456",  
141 - ),  
142 - ), JSON_UNESCAPED_UNICODE)); 168 + $request->setTemplateParamJson($content);
143 169
144 // 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段) 170 // 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
145 // $request->setSmsUpExtendCodeJson("[\"90997\",\"90998\"]"); 171 // $request->setSmsUpExtendCodeJson("[\"90997\",\"90998\"]");