作者 郭鑫

end

... ... @@ -257,4 +257,8 @@ return [
'cmf_default_theme' => 'simpleboot3',
'cmf_admin_theme_path' => 'themes/admin/',
'cmf_admin_default_theme' => 'simpleboot3',
'wx_appid' => 'wxf69d1d87d173c899',
'wx_appsecret' => '93c020c51020d87bda1c0bd98b527ff5',
'wx_mch_id' => '1507884301',
'wx_key' => 'VaY3CqbFLbq2Dw3FRENrixu24E9Qq1ZI',
];
... ...
... ... @@ -20,6 +20,8 @@ class AlipayController extends NotifyCommonController
require_once VENDOR_PATH.'alipay/config.php';
require_once VENDOR_PATH.'alipay/pagepay/service/AlipayTradeService.php';
require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradePagePayContentBuilder.php';
require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradeRefundContentBuilder.php';
require_once VENDOR_PATH.'alipay/pagepay/buildermodel/AlipayTradeFastpayRefundQueryContentBuilder.php';
$this->config = $config;
}
... ... @@ -108,6 +110,42 @@ class AlipayController extends NotifyCommonController
return $response;
}
// 退款查询
public function refundquery($data) {
$config = $this->config;
//商户订单号,商户网站订单系统中唯一订单号
$out_trade_no = '';
if(!empty($data['out_trade_no'])) {
$out_trade_no = trim($data['out_trade_no']);
}
//支付宝交易号
if(!empty($data['trade_no'])) {
$trade_no = trim($data['trade_no']);
}
//请二选一设置
//请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号,必填
$out_request_no = trim($data['out_request_no']);
//构造参数
$RequestBuilder=new \AlipayTradeFastpayRefundQueryContentBuilder();
$RequestBuilder->setOutTradeNo($out_trade_no);
$RequestBuilder->setTradeNo($trade_no);
$RequestBuilder->setOutRequestNo($out_request_no);
$aop = new \AlipayTradeService($config);
/**
* 退款查询 alipay.trade.fastpay.refund.query (统一收单交易退款查询)
* @param $builder 业务参数,使用buildmodel中的对象生成。
* @return $response 支付宝返回的信息
*/
$response = $aop->refundQuery($RequestBuilder);
return $response;
}
// 回调
public function notify_url() {
$config = $this->config;
... ... @@ -182,6 +220,7 @@ class AlipayController extends NotifyCommonController
$where['order_sn'] = $data['out_trade_no'];
// $where['money'] = $data['total_amount'];
$res = $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付');
Db::name('Test')->insertGetId(['data'=>$res]);
if($res) {
$this->redirect('http://bifangjia.cn/Compare_Price/pay/PayResult.html');
} else {
... ...
... ... @@ -21,6 +21,8 @@ class AlipaywapController extends NotifyCommonController
require_once VENDOR_PATH.'alipay_wap/config.php';
require_once VENDOR_PATH.'alipay_wap/wappay/service/AlipayTradeService.php';
require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';
require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeRefundContentBuilder.php';
require_once VENDOR_PATH.'alipay_wap/wappay/buildermodel/AlipayTradeFastpayRefundQueryContentBuilder.php';
$this->config = $config;
}
... ... @@ -56,6 +58,88 @@ class AlipaywapController extends NotifyCommonController
return $result;
}
// 退款
public function refund($data) {
// $data = $this->request->param();
$config = $this->config;
//商户订单号,商户网站订单系统中唯一订单号
$out_trade_no = '';
if(!empty($data['out_trade_no'])) {
$out_trade_no = trim($data['out_trade_no']);
}
//支付宝交易号
if(!empty($data['trade_no'])) {
$trade_no = trim($data['trade_no']);
}
//请二选一设置
//需要退款的金额,该金额不能大于订单金额,必填
$refund_amount = trim($data['refund_amount']);
//退款的原因说明
$refund_reason = trim($data['refund_reason']);
//标识一次退款请求,同一笔交易多次退款需要保证唯一,如需部分退款,则此参数必传
// $out_request_no = trim($data['WIDTRout_request_no']);
$out_request_no = '';
//构造参数
$RequestBuilder=new \AlipayTradeRefundContentBuilder();
$RequestBuilder->setOutTradeNo($out_trade_no);
$RequestBuilder->setTradeNo($trade_no);
$RequestBuilder->setRefundAmount($refund_amount);
$RequestBuilder->setOutRequestNo($out_request_no);
$RequestBuilder->setRefundReason($refund_reason);
$aop = new \AlipayTradeService($config);
/**
* alipay.trade.refund (统一收单交易退款接口)
* @param $builder 业务参数,使用buildmodel中的对象生成。
* @return $response 支付宝返回的信息
*/
$response = $aop->Refund($RequestBuilder);
return $response;
}
// 退款查询
public function refundquery($data) {
$config = $this->config;
//商户订单号,商户网站订单系统中唯一订单号
$out_trade_no = '';
if(!empty($data['out_trade_no'])) {
$out_trade_no = trim($data['out_trade_no']);
}
//支付宝交易号
if(!empty($data['trade_no'])) {
$trade_no = trim($data['trade_no']);
}
//请二选一设置
//请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号,必填
$out_request_no = trim($data['out_request_no']);
//构造参数
$RequestBuilder=new \AlipayTradeFastpayRefundQueryContentBuilder();
$RequestBuilder->setOutTradeNo($out_trade_no);
$RequestBuilder->setTradeNo($trade_no);
$RequestBuilder->setOutRequestNo($out_request_no);
$aop = new \AlipayTradeService($config);
/**
* 退款查询 alipay.trade.fastpay.refund.query (统一收单交易退款查询)
* @param $builder 业务参数,使用buildmodel中的对象生成。
* @return $response 支付宝返回的信息
*/
$response = $aop->refundQuery($RequestBuilder);
return $response;
}
// 回调
public function notify_url() {
$config = $this->config;
... ... @@ -82,30 +166,12 @@ class AlipaywapController extends NotifyCommonController
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
//请务必判断请求时的total_amount与通知时获取的total_fee为一致的
//如果有做过处理,不执行商户的业务程序
$order_model = new OrderModel();
$where['order_sn'] = $out_trade_no;
// $where['money'] = $data['total_amount'];
$where['money'] = 1;
$orderInfo = $order_model->where($where)->find();
if(empty($orderInfo) || $orderInfo['status'] == 9) {
$res = $this->changeOrderStatus($where,$trade_no,3,'pc支付宝支付');
if(!$res) {
echo 'fail';exit;
}
if($orderInfo['status'] == 1) {
$info['pay_type'] = 4;
$info['pay_time'] = time();
$info['status'] = 2;
$info['transaction_id'] = $trade_no;
$order_model->startTrans();
$results = $order_model->where($where)->update($info);
if(!$results) {
$order_model->rollback();
echo 'fail';exit;
} else {
$order_model->commit();
}
}
//注意:
//退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
}
... ... @@ -114,28 +180,12 @@ class AlipaywapController extends NotifyCommonController
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
//请务必判断请求时的total_amount与通知时获取的total_fee为一致的
//如果有做过处理,不执行商户的业务程序
$order_model = new OrderModel();
$where['order_sn'] = $out_trade_no;
// $where['money'] = $data['total_amount'];
$where['money'] = 1;
$orderInfo = $order_model->where($where)->find();
if(empty($orderInfo) || $orderInfo['status'] == 9) {
$res = $this->changeOrderStatus($where,$trade_no,3,'pc支付宝支付');
if(!$res) {
echo 'fail';exit;
}
if($orderInfo['status'] == 1) {
$info['pay_type'] = 4;
$info['pay_time'] = time();
$info['status'] = 2;
$info['transaction_id'] = $trade_no;
$order_model->startTrans();
$results = $order_model->where($where)->update($info);
if(!$results) {
$order_model->rollback();
echo 'fail';exit;
} else {
$order_model->commit();
}
}
//注意:
//付款完成后,支付宝系统发送该交易状态通知
}
... ... @@ -154,7 +204,6 @@ class AlipaywapController extends NotifyCommonController
$result = $alipaySevice->check($arr);
// var_dump($_GET);
// echo '<br/>';
// var_dump($result);exit;
if ($result) {
//商户订单号
$out_trade_no = htmlspecialchars($_GET['out_trade_no']);
... ... @@ -164,30 +213,12 @@ class AlipaywapController extends NotifyCommonController
$data = $_GET;
$where['order_sn'] = $data['out_trade_no'];
// $where['money'] = $data['total_amount'];
$where['money'] = 1;
$order_model = new OrderModel();
$orderInfo = $order_model->where($where)->find();
if($orderInfo['status'] == 1) {
$info['pay_type'] = 4;
$info['pay_time'] = time();
$info['status'] = 2;
$info['transaction_id'] = $data['trade_no'];
$order_model->startTrans();
$results = $order_model->where($where)->update($info);
if(!$results) {
$order_model->rollback();
} else {
$order_model->commit();
if($orderInfo['type'] == 1) {
$this->redirect(url('portal/Index/callback'));
}
if($orderInfo['type'] == 2) {
$this->redirect(url('portal/Index/callback'));
}
if($orderInfo['type'] == 3) {
$this->redirect(url('portal/Index/callback'));
}
}
$res = $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付');
Db::name('Test')->insertGetId(['data'=>$res]);
if($res) {
$this->redirect('http://bifangjia.cn/Compare_Price/pay/PayResult.html');
} else {
$this->redirect('http://bifangjia.cn');
}
}
}
... ...
... ... @@ -29,7 +29,7 @@ class CommonController extends HomeBaseController
$url = explode('/',$_SERVER['PATH_INFO']);
$count_url = count($url);
$fun = $url[$count_url-1];
if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' ){
if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' || $url[1] == 'Index' || $url[1] == 'Thirdsend' ){
$connect = 1;
}else{
$connect = 2;
... ... @@ -94,13 +94,22 @@ class CommonController extends HomeBaseController
$response = SmsDemo::sendSms($tel,$code,$modelVal);
return $response;
}
// 中介短信
public function sendLoginAgency($tel,$code,$modelVal){
require_once VENDOR_PATH."aliyun-dysms-php-sdk/api_demo/SmsDemo.php";
set_time_limit(0);
header('Content-Type: text/plain; charset=utf-8');
$response = SmsDemo::sendSmsAgency($tel,$modelVal);
return $response;
}
// 发送验证码
// $tel 手机号
// $code 短信模板
// $type 类型
public function SmsResult($tel,$code,$type){
// $tel = $request->param('tel');
// $code = 'SMS_137416617';
$modelVal = rand(1000,9999);
$sendResult = $this->sendLogin($tel,$code,$modelVal);
$mes = $sendResult->Message;
... ... @@ -124,17 +133,17 @@ class CommonController extends HomeBaseController
// 用户登录
public function isLogin(){
if($_SESSION['user_id']){
$where_firstLogin['id'] = $_SESSION['user_id'];
$firstMember = Db::name('Member')->where($where_firstLogin)->find();
if($firstMember['update_time'] >= (time()+604800) ){
$this->apiResponse('0','请先登录');
}
}else{
$this->apiResponse('0','请先登录');
}
}
// public function isLogin(){
// if($_SESSION['user_id']){
// $where_firstLogin['id'] = $_SESSION['user_id'];
// $firstMember = Db::name('Member')->where($where_firstLogin)->find();
// if($firstMember['update_time'] >= (time()+604800) ){
// $this->apiResponse('0','请先登录');
// }
// }else{
// $this->apiResponse('0','请先登录');
// }
// }
// 生成订单随机数
public function getmath(){
... ...
... ... @@ -31,8 +31,6 @@ class IndexController extends CommonController
* @url /api/portal/Index/index
* @method POST
* @param name:chooseType type:int require:1 default: other: desc:类型:1手机站,2PC站
*/
public function index(Request $request)
... ... @@ -135,48 +133,17 @@ class IndexController extends CommonController
$this->apiResponse('1','成功',$final);
}
// public function a(){
// // 推荐人处理
// if(!empty($getParam['parent_id'])){
// $where_parentAdd['id'] = $getParam['parent_id'];
// $where_parentAdd['type'] = 2;
// $where_reward['type'] = 2;
// $where_reward['status'] = 1;
// $reward = Db::name('Reward')->where($where_reward)->order('create_time')->field('number')->find();
// if($reward){
// $add_agencyScore = $user->where($where_parentAdd)->setInc('reputation',$reward['number']);
// if(!$add_agencyScore){
// $this->apiResponse('0','推荐奖励增加失败');
// }else{
//// 推荐记录表
// $add_log['type'] = 2;
// $add_log['number'] = $reward['number'];
// $add_log['referee'] = $getParam['parent_id'];
// $add_log['recommen'] = $uid;
// $add_log['create_time'] = time();
// $add_log['update_time'] = time();
// $log = Db::name('RewardLog')->insertGetId($add_log);
// if(!$log){
// Db::rollback();
// }
//// 信誉记录表
// $add_startlog['detail'] = "推荐".$getParam['parent'].'注册';
// $add_startlog['star'] = $reward['number'];
// $add_startlog['type'] = 3;
// $add_startlog['create_time'] = time();
// $add_startlog['update_time'] = time();
// $startLog = Db::name('StartDetail')->insertGetId($add_startlog);
// if(!$startLog){
// Db::rollback();
// }
// }
// }else{
// Db::rollback();
// $this->apiResponse('0','推荐奖励获取失败');
// }
// }
//// end
// }
/**
* @title 两分钟视频
* @description 接口说明
* @author 开发者
* @url /api/portal/Index/video
* @method POST
*/
public function video(){
$where_video['status'] = 1;
$find = Db::name('Video')->where($where_video)->order('create_time desc')->find();
$this->apiResponse('1','成功',$find);
}
}
... ...
... ... @@ -8,6 +8,7 @@
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\OrderModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use api\portal\model\MemberModel;
... ... @@ -165,7 +166,10 @@ class IntermediaryController extends CommonController
*/
public function myIndex(Request $request){
$token = $request->param('token');
$pageInt = $request->param('page');
$member = $this->left($token);
$size = 2;
$all_page = 0;
$quarters = explode('+',$member['quarters']);
$final['intermediary'] = $member;
$where_need['city'] = $member['city'];
... ... @@ -179,8 +183,9 @@ class IntermediaryController extends CommonController
$page = $request->param('page');
$need_list = Db::name('UserNeed')->where($where_need)
->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people,pay_time")
->limit(10)->page($page)
// ->limit($size)->page($page)
->select()->toArray();
if($need_list){
$else_arr = [];
foreach ($need_list as $neek=>$neev){
... ... @@ -191,10 +196,28 @@ class IntermediaryController extends CommonController
$else_arr[] = $neev;
}
}
$final['intermediary_need'] = $else_arr;
// $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);
// 分页
$all_page = count($else_arr);
$page = ceil($all_page/$size);
if($pageInt <1 || $pageInt >$page ){
$this->apiResponse('0','页码错误');
}else{
$start = $pageInt*$size-$size;
$end = $pageInt*$size-1;
foreach ($else_arr as $elsek=>$elsev){
if($elsek >= $start && $elsek <= $end){
$res[] = $elsev;
}
}
}
$final['intermediary_need'] = $res;
}else{
$final['intermediary_need'] = array();
}
$final['all_page'] = ceil($all_page/$size);
$this->apiResponse('1','成功',$final);
}
... ... @@ -212,22 +235,68 @@ class IntermediaryController extends CommonController
$token = $request->param('token');
$member = $this->left($token);
$final['intermediary'] = $member;
$final['money'] = 0;
if(!$request->param('need_id')){
$this->apiResponse('0','请选择需求id');
}else{
$need_id = $request->param('need_id');
}
$where_need['id'] = $request->param('need_id');
$where_need['id'] = $need_id;
$where_need['status'] = 3;
$need_list = Db::name('UserNeed')->where($where_need)
->field("id,user_id,city,quarters,room,floor,house_type,renovation,area,is_first,loan,contract,quotation_time,create_time,people,else,pay_time")
->find();
if($need_list){
// 判断是否已购买透视卡
$where_order['type'] = 3;
$where_order['need_id'] = $need_id;
$where_order['user_id'] = $member['id'];
$is_order = Db::name('Order')->where($where_order)->field('id,lower_price')->find();
if($is_order){
$final['is_see'] = 2;
$final['money'] = $is_order['lower_price'];
$final['pay_time'] = $is_order['pay_time'];
}else{
$where_agency['need_id'] = $request->param('need_id');
$where_agency['status'] = 2;
$agency_count = Db::name('Agency')->where($where_agency)->count();
if($agency_count >=3){
$money = $this->getOrderInfo($token,$need_id);
$final['is_see'] = 1;
$final['money'] = $money['money'];
$final['pay_time'] = $money['pay_time'];
}else{
$final['is_see'] = 0;
}
}
$final['intermediary_need'] = $need_list;
}else{
$final['intermediary_need'] = array();
$final['is_see'] = 0;
}
$this->apiResponse('1','成功',$final);
}
// * @param name:token type:char require:1 default: other: desc:用户token
// * @param name:need_id type:int require:1 default: other: desc:需求id
public function getOrderInfo($token,$need_id) {
$member_model = new MemberModel();
$user = $member_model->field(['id,money'])->where(['token'=>$token])->find();
$order_model = new OrderModel();
$price = $order_model->where(['need_id'=>$need_id,'user_id'=>$user['id'],'type'=>3,'status'=>2])->field('money,pay_time')->find();
if(empty($price)) {
return false;
}
return $price;
}
// 查询中介报价
// $need_id 需求id
public function agencyOffer($user_id,$need_id){
... ... @@ -276,48 +345,48 @@ class IntermediaryController extends CommonController
// 透视卡
//token
//need_id
public function see(Request $request){
$data = $request->param();
$user = $this->left($data['token']);
$user_id = $user['id'];
// 购买支付
// 成功加入记录
// 加订单
$add = array();
$add['name'] = '购买透视卡';
$add['order_sn'] = $this->getmath();
$add['type'] = 3;
$add['need_id'] = $data['need_id'];
$add['is_get'] = 2;
// 查询透视卡金额
$add['money'] = 2;
$add['status'] = 1;
$add['create_time'] = time();
$add['update_time'] = time();
$order_id = Db::name('Order')->insertGetId($add);
if(!$order_id){
$this->apiResponse('0','购买失败');
}
// 支付成功
// 修改订单状态
$where_order['order_sn'] = $data['order_sn'];
$save['update_time'] = time();
$save['pay_time'] = time();
$is_save = Db::name('Order')->where($where_order)->update($save);
if($is_save){
return true;
}else{
return false;
}
// 查询报价
$money = $this->agencyOffer($user_id,$data['need_id']);
}
// public function see(Request $request){
// $data = $request->param();
// $user = $this->left($data['token']);
// $user_id = $user['id'];
//// 购买支付
//
//
//
//// 成功加入记录
//// 加订单
// $add = array();
// $add['name'] = '购买透视卡';
// $add['order_sn'] = $this->getmath();
// $add['type'] = 3;
// $add['need_id'] = $data['need_id'];
// $add['is_get'] = 2;
//// 查询透视卡金额
// $add['money'] = 2;
//
// $add['status'] = 1;
// $add['create_time'] = time();
// $add['update_time'] = time();
// $order_id = Db::name('Order')->insertGetId($add);
// if(!$order_id){
// $this->apiResponse('0','购买失败');
// }
//
//// 支付成功
//// 修改订单状态
// $where_order['order_sn'] = $data['order_sn'];
// $save['update_time'] = time();
// $save['pay_time'] = time();
// $is_save = Db::name('Order')->where($where_order)->update($save);
// if($is_save){
// return true;
// }else{
// return false;
// }
//// 查询报价
// $money = $this->agencyOffer($user_id,$data['need_id']);
//
// }
/**
* @title 中介个人中心我的报价(sure)
... ... @@ -328,37 +397,43 @@ class IntermediaryController extends CommonController
* @param name:token type:int require:1 default: other: desc:token
* @param name:page type:int require:1 default: other: desc:页码
*/
public function myMoney(Request $request){
$data = $request->param();
$size = 2;
$my = $this->left($data['token']);
$final['intermediary'] = $my;
$where_need['a.agency_id'] = $my['id'];
$page = $data['page'];
$need = Db::name('Agency')->alias('a')
->where($where_need)
->join("UserNeed n",'n.id = a.need_id')
->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,
public function myMoney(Request $request){
$data = $request->param();
$size = 2;
$my = $this->left($data['token']);
$final['intermediary'] = $my;
$where_need['a.agency_id'] = $my['id'];
$page = $data['page'];
$need = Db::name('Agency')->alias('a')
->where($where_need)
->join("UserNeed n",'n.id = a.need_id')
->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,
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
")
->limit($size)->page($page)
->select()->toArray();
if($need){
$number = Db::name('Agency')->alias('a')
->where($where_need)
->join("UserNeed n",'n.id = a.need_id')
->count();
$final['all_page'] = ceil($number/$size);
foreach ($need as $nk=>$nv){
$changeInt = (int)$nv['all_price'];
$need[$nk]['intPrice'] = substr($changeInt,0,-4);
}
$final['need'] = $need;
}else{
$final['need'] = array();
}
$this->apiResponse('1','成功',$final);
}
->limit($size)->page($page)
->select()->toArray();
$all_page = Db::name('Agency')->alias('a')
->where($where_need)
->join("UserNeed n",'n.id = a.need_id')
->count();
if($need){
$number = Db::name('Agency')->alias('a')
->where($where_need)
->join("UserNeed n",'n.id = a.need_id')
->count();
$final['all_page'] = ceil($number/$size);
foreach ($need as $nk=>$nv){
$changeInt = (int)$nv['all_price'];
$need[$nk]['intPrice'] = substr($changeInt,0,-4);
}
$final['need'] = $need;
}else{
$final['need'] = array();
}
$final['all_page'] = ceil($all_page/$size);
$this->apiResponse('1','成功',$final);
}
/**
* @title 中介个人中心我的报价详情(sure)
... ... @@ -559,6 +634,110 @@ class IntermediaryController extends CommonController
}
}
/**
* @title 中介确认成交(sure)
* @description 接口说明
* @author 开发者
* @url /api/portal/Intermediary/sure
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:intermediary_id type:int require:1 default: other: desc:中介报价id
* @return data:''
*/
public function sure(Request $request){
$data = $request->param();
$where_agency['a.id'] = $data['intermediary_id'];
$where_agency['a.status'] = 5;
$agency = Db::name('Agency')->alias('a')
->join('Member m','m.id = a.agency_id')
->where($where_agency)
->field('a.*,m.referee_id,m.name,m.tel')
->find();
if($agency){
$where_need['id'] = $agency['need_id'];
$where_need['status'] = 7;
$need = Db::name('UserNeed')->where($where_need)->find();
if($need){
Db::startTrans();
$update_agency['status'] = 11;
$update_agency['update_time'] = time();
$add_agency = Db::name('Agency')->alias('a')->where($where_agency)->update($update_agency);
$update_need['status'] = 10;
$update_need['update_time'] = time();
$add_need = Db::name('UserNeed')->where($where_need)->update($update_need);
if($add_agency && $add_need){
// 判断是否已返
$where_findstatus['token'] = $data['token'];
$get_money = Db::name('Member')->where($where_findstatus)->value('is_getmoney');
if($get_money == 0){
// 增加推荐人返利金额
if($agency['referee_id']){
$where_parent['id'] = $agency['referee_id'];
$parent = Db::name('Member')->where($where_parent)->find();
// 诚意金金额获取
$where_reward['type'] = 5;
$where_reward['status'] = 1;
$reward = Db::name('Reward')->where($where_reward)->find();
if($parent){
$add_detail['user_id'] = $agency['referee_id'];
$add_detail['user_type'] = $parent['type'];
$add_detail['title'] = '推荐'.$agency['user_id'];
$add_detail['money'] = $reward['number'];
$add_detail['order_type'] = 7;
$add_detail['type'] = 1;
$add_detail['status'] = 1;
$add_detail['create_time'] = time();
$add_detail['update_time'] = time();
$add_res = Db::name('MoneyDetail')->insertGetId($add_detail);
if($add_res){
$where_addParent['id'] = $agency['referee_id'];
$add_parent = Db::name('Member')->where($where_addParent)->setInc('money',$reward['number']);
if(!$add_parent){
Db::rollback();
$this->apiResponse('0','确认失败');
}
}else{
Db::rollback();
$this->apiResponse('0','确认失败');
}
}else{
Db::rollback();
$this->apiResponse('0','推荐人错误');
}
}
}
// 退回需求用户保证金
$need['user_type'] = Db::name('Member')->where(['id'=>$need['user_id']])->value('type');
$thirdsend = controller('Thirdsend','controller');
$thirdsend->need_order_refund($need,'中介确认成交退款');
// 给中介发送信息
$sendResult = $this->sendLoginAgency($agency['tel'],$agency['name']);
if($sendResult != 'OK'){
$this->apiResponse('0',$sendResult);
}
Db::commit();
$this->apiResponse('1','确认成功');
}else{
Db::rollback();
$this->apiResponse('0','确认失败');
}
}else{
$this->apiResponse('0','需求状态错误');
}
}else{
$this->apiResponse('0','报价状态错误');
}
}
... ...
... ... @@ -65,6 +65,7 @@ class IntermediaryneedController extends CommonController
* @url /api/portal/Intermediaryneed/sendNeed
* @method POST
* @param name:token type:int require:1 default: other: desc:token
* @param name:page type:int require:1 default: other: desc:分页
* @return data:''@
* @data city:'地区'
* @data quarters:'小区'
... ... @@ -78,6 +79,8 @@ class IntermediaryneedController extends CommonController
*/
public function sendNeed(Request $request){
$data = $request->param();
$page = $data['page'];
$size = 2;
$where_member['token'] = $data['token'];
// 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配)
$member_find = Db::name('Member')->where($where_member)->field("city,quarters")->find();
... ... @@ -94,9 +97,12 @@ class IntermediaryneedController extends CommonController
}
}
$where_need['quarters'] = array('like',$quarters,'OR');
$need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people")->select()->toArray();
$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();
$count = Db::name('UserNeed')->where($where_need)->count();
$final['all_page'] = ceil($count/$size);
$final['need_list'] = $need_list;
if($need_list){
$this->apiResponse('1','成功',$need_list);
$this->apiResponse('1','成功',$final);
}else{
$this->apiResponse('0','该地区暂无匹配需求');
}
... ... @@ -129,6 +135,7 @@ class IntermediaryneedController extends CommonController
// header('Access-Control-Allow-Origin:*');
if($request->Post('token') && $request->Post('housing_price')){
// 判空,处理
Db::startTrans();
$validate = Loader::validate('IntermediaryNeed');
if(!$validate->scene('offer')->check($_POST)){
return json(array('code'=>0,'msg'=>$validate->getError()));
... ... @@ -144,6 +151,7 @@ class IntermediaryneedController extends CommonController
$where_isIsset['agency_id'] = $mem_id['id'];
$find_isset = $model->where($where_isIsset)->find();
if($find_isset){
Db::rollback();
$this->apiResponse('0','该房屋您已参与报价');
}
// 判断是否存在
... ... @@ -151,6 +159,7 @@ class IntermediaryneedController extends CommonController
$where_issetNeed['status'] = 3;
$issetNeed = Db::name('UserNeed')->where($where_issetNeed)->find();
if(!$issetNeed){
Db::rollback();
$this->apiResponse('0','需求错误');
}
$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
$where_inteRule['height'] = array('egt',$data['housing_price']);
$inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find();
if(!$inte_money){
Db::rollback();
$this->apiResponse('0','保证金获取失败');
}else{
$data['deposit'] = $inte_money['money'];
... ... @@ -170,8 +180,17 @@ class IntermediaryneedController extends CommonController
$final['intermediaryNeed_id'] = $model->getLastInsID();
if($save){
$this->apiResponse('1','添加成功',$final);
$where_addCount['token'] = $data['token'];
$add_count = Db::name('member')->where($where_addCount)->setInc('count_agency',1);
if($add_count){
Db::rollback();
}else{
Db::commit();
$this->apiResponse('1','添加成功',$final);
}
}else{
Db::rollback();
$this->apiResponse('0','添加失败');
}
}else{
... ...
... ... @@ -38,7 +38,6 @@ class NotifyCommonController extends HomeBaseController
'pay_time' => time(),
'transaction_id'=>$transaction_id
];
Db::name('Test')->insertGetId(['data'=>0]);
// 根据支付类型修改不同表的数据
if($orderInfo['type'] == 1) {
$user_need_model = new UserNeedModel();
... ... @@ -59,14 +58,14 @@ class NotifyCommonController extends HomeBaseController
}
if(!$pay || !$status) {
$order_model->rollback();
return false;
return 0;
}
// 记录用户金额记录
$member_model = new MemberModel();
$user = $member_model->field(['id,type'])->where(['id'=>$orderInfo['user_id']])->find();
$user = $member_model->field(['id,type,referee_id'])->where(['id'=>$orderInfo['user_id']])->find();
if(!$user) {
$order_model->rollback();
return false;
return 0;
}
$money_detail_model = new MoneyDetailModel();
if($orderInfo['type'] == 1) {
... ... @@ -87,43 +86,47 @@ class NotifyCommonController extends HomeBaseController
'order_type' => $order_type,
'type' => 2,
'pay_type' => $pay_type,
'create_time' => time()
'create_time' => time(),
'update_time' => time()
];
$money_detail_insert = $money_detail_model->insertGetId($insert);
if(!$money_detail_insert) {
$order_model->rollback();
return false;
return 0;
}
// 增加用户推荐人余额
if($user['referee_id'] && ($orderInfo['type'] == 1 || $orderInfo['type'] == 2)) {
$referee_user = $member_model->where(['id'=>$user['referee_id']])->find();
if($referee_user) {
$reward_model = new RewardModel();
$reward_number = $reward_model->where(['type'=>5,'status'=>['neq',9]])->value('number');
$referee_result = $member_model->where(['id'=>$user['referee_id']])->setInc('money',$reward_number);
if(!$referee_result) {
$order_model->rollback();
return false;
}
$insert = [
'user_id' => $user['id'],
'user_type' => $user['type'],
'title' => '推荐人奖励',
'money' => $reward_number,
'order_type' => 7,
'type' => 1,
'pay_type' => 3,
'create_time' => time()
];
$money_detail_insert2 = $money_detail_model->insertGetId($insert);
if(!$money_detail_insert2) {
$order_model->rollback();
return false;
}
}
}
// if(!empty($user['referee_id']) && ($orderInfo['type'] == 1 || $orderInfo['type'] == 2)) {
//// $referee_user = $member_model->where(['id'=>$user['referee_id']])->find();
////// Db::name('Test')->insertGetId(['data'=>json_encode($referee_user)]);
//// if(!empty($referee_user)) {
//// $reward_model = new RewardModel();
//// $reward_number = $reward_model->where(['type'=>5,'status'=>['neq',9]])->value('number');
//// $referee_result = $member_model->where(['id'=>$user['referee_id']])->setInc('money',$reward_number);
//// if(!$referee_result) {
//// $order_model->rollback();
//// return 0;
//// }
//// $insert = [
//// 'order_id' => $orderInfo['id'],
//// 'user_id' => $user['id'],
//// 'user_type' => $user['type'],
//// 'title' => '推荐人奖励',
//// 'money' => $reward_number,
//// 'order_type' => 7,
//// 'type' => 1,
//// 'pay_type' => 3,
//// 'create_time' => time(),
//// 'update_time' => time()
//// ];
//// $money_detail_insert2 = $money_detail_model->insertGetId($insert);
//// if(!$money_detail_insert2) {
//// $order_model->rollback();
//// return 0;
//// }
//// }
//// }
$order_model->commit();
return true;
return 1;
}
}
... ...
... ... @@ -9,6 +9,8 @@
namespace api\portal\controller;
use api\portal\controller\NotifyCommonController;
use think\Config;
use think\Db;
class NotifyController extends NotifyCommonController
{
... ... @@ -33,11 +35,17 @@ class NotifyController extends NotifyCommonController
if($base->CheckSign() == true){
if ($data["return_code"] == "SUCCESS") {
$where['order_sn'] = $data['attach'];
if (!$where['order_sn']) {
if (empty($where['order_sn'])) {
$where['order_sn'] = $data['out_trade_no'];
}
// $where['money'] = $data['total_fee']/100;
$result = $this->changeOrderStatus($where,$data['transaction_id'],1,'pc微信扫码支付');
$pay_type = 1;
$title = 'pc微信扫码支付';
if($data["trade_type"] == 'MWEB') {
$pay_type = 2;
$title = '网页H5支付';
}
$result = $this->changeOrderStatus($where,$data['transaction_id'],$pay_type,$title);
if($result) {
$this->return_success();
}
... ... @@ -46,6 +54,132 @@ class NotifyController extends NotifyCommonController
}
}
/**
* 微信支付退款结果回调
*/
public function refund_notify() {
$post = $this->request->param();
if($post==null){
$post = file_get_contents("php://input");
if($post == null){
$post = $GLOBALS['HTTP_RAW_POST_DATA'];
}
}
if(!empty($post)) {
$xml = $post; //微信的回调数据
$data = $this->xmlToArray($xml);
if($data['return_code'] == 'SUCCESS' && !empty($data['req_info'])) {
$key = md5(Config::get('wx_key'));
$array = $this->xmlToArray($this->refund_decrypt($data['req_info'],$key));
$refund_where = [
'order_sn' => $array['out_refund_no'],
'refund_id' => $array['refund_id'],
];
$order_where = [
'transaction_id' => $array['transaction_id'],
];
$handle_sql = true;
Db::startTrans();
if($array['refund_status'] == 'SUCCESS') {
$refundInfo = Db::name('Refund')->where($refund_where)->find();
$refund_update = [
'status' => 2,
'refund_time' => strtotime($array['success_time']),
'remark' => $array['refund_account'],
'more' => json_encode($array),
];
$refund_result = Db::name('Refund')->where($refund_where)->update($refund_update);
$order_update = [
'status' => 4,
'refund_time' => strtotime($array['success_time'])
];
$order_result = Db::name('Order')->where($order_where)->update($order_update);
$order_type = '';
if($refundInfo['user_type'] == 1) {
$order_type = 4;
}if($refundInfo['user_type'] == 2) {
$order_type = 5;
}
$insert = [
'order_id' => $refundInfo['order_id'],
'user_id' => $refundInfo['user_id'],
'user_type' => $refundInfo['user_type'],
'title' => '退款',
'order_type' => $order_type,
'type' => 1,
'reason' => $refundInfo['reason'],
'create_time' => time(),
'update_time' => time()
];
$money_detail_insert = Db::name('MoneyDetail')->insertGetId($insert);
if(!$refund_result || !$order_result || !$money_detail_insert) {
$handle_sql = false;
}
} elseif($array['refund_status'] == 'CHANGE') {
$refund_update = [
'status' => 4,
// 'refund_time' => strtotime($array['success_time']),
// 'remark' => $array['refund_account'],
'more' => json_encode($array),
];
$refund_result = Db::name('Refund')->where($refund_where)->update($refund_update);
if(!$refund_result) {
$handle_sql = false;
}
} elseif($array['refund_status'] == 'REFUNDCLOSE') {
$refund_update = [
'status' => 3,
// 'refund_time' => strtotime($array['success_time']),
// 'remark' => $array['refund_account'],
'more' => json_encode($array),
];
$refund_result = Db::name('Refund')->where($refund_where)->update($refund_update);
if(!$refund_result) {
$handle_sql = false;
}
}
if(!$handle_sql) {
Db::rollback();
} else {
Db::commit();
$this->return_success();
}
}
}
}
/**
* 微信退款回调数据
* (1)对加密串A做base64解码,得到加密串B
* (2)对商户key做md5,得到32位小写key* ( key设置路径:微信商户平台(pay.weixin.qq.com)-->账户设置-->API安全-->密钥设置 )
* (3)用key*对加密串B做AES-256-ECB解密(PKCS7Padding)
*/
private function refund_decrypt($str, $key) {
$str = base64_decode($str);
$decrypted = openssl_decrypt($str, 'AES-256-ECB', $key, OPENSSL_RAW_DATA);
return $decrypted;
}
//xml转换成数组
private function xmlToArray($xml) {
//禁止引用外部xml实体
libxml_disable_entity_loader(true);
$xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
$val = json_decode(json_encode($xmlstring), true);
return $val;
}
/*
* 给微信发送确认订单金额和签名正确,SUCCESS信息
*/
... ...
... ... @@ -51,7 +51,7 @@ class OrderController extends CommonController
$money = $info['pay_money'];
}
if($data['_type'] == 2) {
$info = $agency_model->where(['id'=>$data['need_id'],'agency_id'=>$user_id])->find();
$info = $agency_model->where(['need_id'=>$data['need_id'],'agency_id'=>$user_id])->find();
$need = $user_need_model->where(['id'=>$info['need_id']])->find();
if($need['status'] != 3) {
$this->apiResponse(0,'该需求当前状态无法进行报价');
... ... @@ -124,7 +124,7 @@ class OrderController extends CommonController
}
if($orderInfo['type'] == 2) {
$info = $agency_model->where(['id'=>$orderInfo['need_id'],'agency_id'=>$user['id']])->find();
$need = $user_need_model->where(['id'=>$info['need_id'],'user_id'=>$user['id']])->find();
$need = $user_need_model->where(['id'=>$info['need_id']])->find();
if($need['status'] != 3) {
$this->apiResponse(0,'该需求当前状态无法进行报价');
}
... ... @@ -137,49 +137,41 @@ class OrderController extends CommonController
if(($orderInfo['type'] == 1 && $info['status'] == 1) ||
($orderInfo['type'] == 3 && $info['status'] == 3) ||
($orderInfo['type'] == 2 && $info['status'] == 1)) {
// if($data['_type'] == 5) {
// if($user['money'] < $orderInfo['money']) {
// $this->apiResponse(0,'余额不足');
// } else {
// $order_model->startTrans();
// $where = [
// 'order_sn' => $data['order_sn']
// ];
// $update = [
// 'status' => 2,
// 'pay_type' => 5,
// 'pay_time' => time()
// ];
// if($orderInfo['type'] == 1) {
// $pay = $order_model->where($where)->update($update);
// $status = $user_need_model->where()->update(['status'=>2,'pay_time'=>time()]);
// }
// if($orderInfo['type'] == 2) {
// $pay = $order_model->where($where)->update($update);
// $status = $agency_model->where()->update(['status'=>2,'pay_time'=>time()]);
// }
// if($orderInfo['type'] == 3) {
// $Intermediary = controller('Intermediary','controller');
// $agencyOffer = $Intermediary->agencyOffer($user['id'],$info['id']);
// $update['lower_price'] = $agencyOffer['money'];
// $pay = $order_model->where($where)->update($update);
// $status = 1;
// }
// if(!$pay || !$status) {
// $order_model->rollback();
// $this->apiResponse(0,'支付失败');
// }
// $order_model->commit();
// $this->apiResponse(5,'支付成功');
// }
// }
if($data['_type'] == 1) {
$return = $this->wxpay(['order_sn'=>$data['order_sn']],$sort);
$qrcode_url = url('portal/Qrcode/qrcode',['data'=>urlencode($return['code_url'])],true,true);
if(empty($return['code_url'])) {
$this->apiResponse(0,$return['return_msg']);
} else {
$code_url = $return['code_url'];
}
$qrcode_url = url('portal/Qrcode/qrcode',['data'=>urlencode($code_url)],true,true);
$this->apiResponse(1,'微信支付',['type'=>1,'url'=>$qrcode_url]);
} elseif($data['_type'] == 2) {
$type = [
1 => '保证金支付',
2 => '中介报价',
3 => '透视卡'
];
require_once VENDOR_PATH.'WxpayAPI/WxpayH5.php';
$scene_info = "{'h5_info': {'type':'Wap','wap_url': 'http://houseprice.w.bronet.cn','wap_name': ".$sort."}}";
$h5 = new \WxpayH5(config('wx_appid'),config('wx_mch_id'),config('wx_key'),$data['order_sn'],
$type[$orderInfo['type']],'1',$scene_info);
$result = $h5->pay();
if(empty($result['mweb_url'])) {
$this->apiResponse(0,'生成支付失败');
}
// $return = [
// 'mwen_url' => $result['mweb_url'],
// 'create_time' => time(),
// 'over_time'=>time()+5*60
// ];
$this->apiResponse(1,'微信H5支付',['type'=>2,'url'=>$result['mweb_url']]);
} elseif($data['_type'] == 3) {
$alipay_url = url('portal/Alipay/alipay',['order_sn'=>$data['order_sn'],'name'=>$sort,'price'=>0.01],true,true);
$this->apiResponse(1,'支付宝支付',['type'=>3,'url'=>$alipay_url]);
} elseif($data['_type'] == 4) {
$alipay_url = url('portal/Alipaywap/alipay',['order_sn'=>$data['order_sn'],'name'=>$sort,'price'=>0.01],true,true);
$this->apiResponse(1,'支付宝手机支付',['type'=>4,'url'=>$alipay_url]);
}
} else {
$this->apiResponse(0,'该订单已失效');
... ... @@ -286,4 +278,27 @@ class OrderController extends CommonController
$this->apiResponse(1,'成功', $name);
}
}
/**
* @title 根据订单号查询订单信息(购买透视卡查询到的最低价)
* @description 接口说明
* @author 开发者
* @url /api/portal/Order/getOrderInfo
* @method POST
* @param name:token type:char require:1 default: other: desc:用户token
* @param name:need_id type:int require:1 default: other: desc:需求ID
*
*/
public function getOrderInfo($token,$need_id) {
// if($this->request->isPost()) {
$member_model = new MemberModel();
$user = $member_model->field(['id,money'])->where(['token'=>$token])->find();
$order_model = new OrderModel();
$array = $order_model->field('pay_time,lower_price')->where(['need_id'=>$need_id,'user_id'=>$user['id'],'type'=>3,'status'=>2])->find();
if(empty($array)) {
return false;
}
return $array;
// }
}
}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,7 @@ namespace api\portal\controller;
use api\portal\model\AgencyModel;
use api\portal\model\OrderModel;
use api\portal\model\RefundModel;
use api\portal\model\UserNeedModel;
use cmf\controller\HomeBaseController;
use api\portal\model\PortalPostModel;
... ... @@ -181,6 +182,7 @@ class ThirdsendController extends HomeBaseController
if(!$userNeedList){
$this->apiResponse('0','需求状态不正确');
}
$userNeedList['user_type'] = Db::name('Member')->where(['id'=>$userNeedList['user_id']])->value('type');
$time = time();
// 查询相应报价
$final_time = $userNeedList['pay_time'] + $userNeedList['quotation_time'] * 86400;
... ... @@ -195,24 +197,23 @@ class ThirdsendController extends HomeBaseController
$agency_list = Db::name('Agency')->alias('a')
->where($where_agency)
->join("hp_Member m", 'm.id = a.agency_id')
->field('a.*,m.company')
->field('a.*,m.company,m.type as user_type')
->select()->toArray();
// 查询品牌企业
$where_brand['status'] = 1;
$band_list = Db::name('Brand')->where($where_brand)->column('name');
$agen_arr = array();
$agen_arr = $is_trueMoney = array();
if ($agency_list) {
$get_list = array();
// 删除十万以内报价
foreach ($agency_list as $tenk=>$tenv){
$ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge'];
if($ten_money > 1000000){
if($ten_money > 100000){
$is_trueMoney[] = $tenv;
}
}
// 判断是否超过三个报价人
if (count($is_trueMoney) >= 3) {
// 查询三人中是否有品牌中介
// 循环匹配品牌企业
foreach ($is_trueMoney as $agencyk => $agencyv) {
... ... @@ -257,6 +258,8 @@ class ThirdsendController extends HomeBaseController
}else{
$get_list = $fin_arr;
}
}else{
$get_list = $fin_arr;
}
foreach ($else_changeList as $getk=>$getv){
if(in_array($getv,$get_list)){
... ... @@ -266,7 +269,12 @@ class ThirdsendController extends HomeBaseController
$change_final['id'] = $getv;
$change_final['status'] = 3;
// 中介报价未进入决赛,执行订单退款
$refund_result = $this->agency_order_refund($getv,'中介报价未进入决赛圈退款');
$agencyInfo = Db::name('Agency')->alias('a')
->where(['a.id'=>$getv])
->join("hp_Member m", 'm.id = a.agency_id')
->field('a.*,m.company,m.type as user_type')
->find();
$refund_result = $this->agency_order_refund($agencyInfo,'中介报价未进入决赛圈退款',2);
}
$agencyModel = new AgencyModel();
$fianl_AgsaveFirst = $agencyModel->isUpdate(true)->save($change_final);
... ... @@ -275,7 +283,7 @@ class ThirdsendController extends HomeBaseController
}
}
// 报价成功,更改状态
$userSave_statusFirst['id'] = $userNeedList['need_id'];
$userSave_statusFirst['id'] = $userNeedList['id'];
$userSave_statusFirst['status'] = 5;
$userSave_statusFirst['choose_time'] = time();
$userNeedModel = new UserNeedModel();
... ... @@ -295,28 +303,7 @@ class ThirdsendController extends HomeBaseController
Db::rollback();
}
// 中介报价订单退款
$refund_result = $this->agency_order_refund($changeva,'中介报价少于3人退款');
// 退回中介保证金
// $add_a['user_id'] = $changeva['agency_id'];
// $add_a['title'] = '报价人数不足';
// $add_a['type'] = 1;
// $add_a['reason'] = 1;
// $add_a['money'] = $changeva['deposit'];
// $add_a['create_time'] = time();
// $add_a['update_time'] = time();
// $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
// if (!$amoney_id) {
// Db::rollback();
// }
// 用户表增加金额
$where_member['type'] = 2;
$where_member['id'] = $changeva['agency_id'];
$add_money = Db::name('Member')->where($where_member)->setInc('money',$changeva['deposit']);
if (!$add_money) {
Db::rollback();
}
$refund_result = $this->agency_order_refund($changeva,'中介报价少于3人退款',1);
}
$userSave_status['id'] = $userNeedList['id'];
$userSave_status['status'] = 4;
... ... @@ -327,29 +314,7 @@ class ThirdsendController extends HomeBaseController
}
// 用户需求订单退款
$refund_result = $this->need_order_refund($userNeedList,'报价人数不足');
// 退回保证金
// 用户
// 加用户金额明细表
// $add_del['need_id'] = $userNeedList['id'];
// $add_del['user_id'] = $userNeedList['user_id'];
// $add_del['title'] = '报价人数不足';
// $add_del['reason'] = 1;
// $add_del['type'] = 1;
// $add_del['money'] = $userNeedList['pay_money'];
// $add_del['create_time'] = time();
// $add_del['update_time'] = time();
// $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
// if (!$umoney_id) {
// Db::rollback();
// }
$where_memberNext['type'] = 1;
$where_memberNext['id'] = $userNeedList['user_id'];
$add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);
if (!$add_moneyNext) {
Db::rollback();
}
$refund_result = $this->need_order_refund($userNeedList,'报价人数不足',1);
}
} else {
// 没有报价
... ... @@ -361,30 +326,7 @@ class ThirdsendController extends HomeBaseController
Db::rollback();
}
// 用户需求订单退款
$refund_result = $this->need_order_refund($userNeedList,'报价人数不足');
// 退回保证金
// 用户
// 加用户金额明细表
// $add_del['need_id'] = $userNeedList['id'];
// $add_del['user_id'] = $userNeedList['user_id'];
// $add_del['title'] = '报价人数不足';
// $add_del['type'] = 1;
// $add_del['money'] = $userNeedList['pay_money'];
// $add_del['create_time'] = time();
// $add_del['update_time'] = time();
// $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
// if (!$umoney_id) {
// Db::rollback();
// $this->apiResponse('0','金额明细添加失败');
// }
$where_memberNext['type'] = 1;
$where_memberNext['id'] = $userNeedList['user_id'];
$add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);
if (!$add_moneyNext) {
Db::rollback();
}
$refund_result = $this->need_order_refund($userNeedList,'报价人数不足',1);
}
// 插入数据库
// 用户需求表
... ... @@ -396,7 +338,6 @@ class ThirdsendController extends HomeBaseController
}else{
$this->apiResponse('0','时间不正确');
}
// }
}
... ... @@ -425,9 +366,13 @@ class ThirdsendController extends HomeBaseController
if($userNeedList){
// foreach ($userNeedList as $needk=>$needv) {
if (time() >= ($userNeedList['choose_time'] + 259200)) {
$where_agency['need_id'] = $userNeedList['id'];
$where_agency['status'] = 4;
$agency_list = Db::name('Agency')->where($where_agency)->select()->toArray();
$where_agency['a.need_id'] = $userNeedList['id'];
$where_agency['a.status'] = 4;
$agency_list = Db::name('Agency')->alias('a')
->where($where_agency)
->join("hp_Member m", 'm.id = a.agency_id')
->field('a.*,m.company,m.type as user_type')
->select()->toArray();
if ($agency_list) {
$where_agencyUpdate['need_id'] = $userNeedList['id'];
$where_agencyUpdate['status'] = 4;
... ... @@ -437,10 +382,6 @@ class ThirdsendController extends HomeBaseController
if (!$agency_result) {
Db::rollback();
}
foreach ($agency_list as $agency_key=>$agency_val) {
// 中介报价订单退款
$refund_result = $this->agency_order_refund($agency_val,'用户未选择中标中介退款');
}
}
$where_needUpdate['id'] = $userNeedList['id'];
$needUpdate['status'] = 6;
... ... @@ -448,39 +389,12 @@ class ThirdsendController extends HomeBaseController
if (!$need_result) {
Db::rollback();
} else {
// 加用户金额明细表
$add_del['need_id'] = $userNeedList['id'];
$add_del['user_id'] = $userNeedList['user_id'];
$add_del['title'] = '未选择中介';
$add_del['type'] = 2;
$add_del['money'] = $userNeedList['pay_money'];
$add_del['create_time'] = time();
$add_del['update_time'] = time();
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
if (!$umoney_id) {
Db::rollback();
if ($agency_list) {
foreach ($agency_list as $agency_key => $agency_val) {
// 中介报价订单退款
$this->agency_order_refund($agency_val, '用户未选择中标中介退款',3);
}
}
// 中介金额明细表
// foreach ($agency_list as $agenk=>$agenv){
// $add_a['ag_id'] = $agenv['id'];
// $add_a['user_id'] = $agenv['agency_id'];
// $add_a['title'] = '用户未选择中介';
// $add_a['type'] = 1;
// $add_a['money'] = $agenv['deposit'];
// $add_a['create_time'] = time();
// $add_a['update_time'] = time();
// $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
// if (!$amoney_id) {
// Db::rollback();
// }
// $where_member['type'] = 2;
// $where_member['id'] = $agenv['agency_id'];
// $add_money = Db::name('Member')->where($where_member)->setInc('money',$agenv['deposit']);
// if (!$add_money) {
// Db::rollback();
// }
// }
}
}
// }
... ... @@ -530,18 +444,6 @@ class ThirdsendController extends HomeBaseController
Db::rollback();
}
}
// 增加中介保证金变化
$add_a['ag_id'] = $agency['id'];
$add_a['user_id'] = $agency['agency_id'];
$add_a['title'] = '中介未确认';
$add_a['type'] = 2;
$add_a['money'] = $agency['deposit'];
$add_a['create_time'] = time();
$add_a['update_time'] = time();
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
if (!$amoney_id) {
Db::rollback();
}
// 修改用户需求状态
$where_needChange['id'] = $need_list['id'];
$update_need['status'] = 8;
... ... @@ -550,24 +452,8 @@ class ThirdsendController extends HomeBaseController
if (!$change_needFinal) {
Db::rollback();
}
// 增加用户保证金,余额
$add_del['need_id'] = $need_list['id'];
$add_del['user_id'] = $need_list['user_id'];
$add_del['title'] = '中介未确认';
$add_del['type'] = 1;
$add_del['money'] = $need_list['pay_money'];
$add_del['create_time'] = time();
$add_del['update_time'] = time();
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
if (!$umoney_id) {
Db::rollback();
}
$where_member['type'] = 1;
$where_member['id'] = $need_list['user_id'];
$add_money = Db::name('Member')->where($where_member)->setInc('money',$need_list['pay_money']);
if (!$add_money) {
Db::rollback();
}
$need_list['user_type'] = Db::name('Member')->where(['id'=>$need_list['user_id']])->value('type');
$this->need_order_refund($agency,'中介未确认成交退款',5);
}
// }
Db::commit();
... ... @@ -640,7 +526,7 @@ class ThirdsendController extends HomeBaseController
// 删除十万以内报价
foreach ($agency_list as $tenk=>$tenv){
$ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge'];
if($ten_money > 1000000){
if($ten_money > 100000){
$is_trueMoney[] = $tenv;
}
}
... ... @@ -969,7 +855,7 @@ class ThirdsendController extends HomeBaseController
* @param needInfo 用户需求信息
* @param reason 退款原因
*/
private function need_order_refund($needInfo,$reason) {
public function need_order_refund($needInfo,$reason,$reason_id) {
$order_model = new OrderModel();
$where = [
'user_id' => $needInfo['user_id'],
... ... @@ -980,18 +866,20 @@ class ThirdsendController extends HomeBaseController
];
// 根据不同订单类型执行退款操作
$orderInfo = $order_model->where($where)->find();
$orderInfo['user_type'] = $needInfo['user_type'];
$transaction_id = $orderInfo['transaction_id'];
$order_sn = $orderInfo['order_sn'];
$money = $orderInfo['money'];
// $money = $orderInfo['money'];
$money = 0.01;
$out_refund_no = cmf_get_order_sn();
// 微信
$refund_result = false;
if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) {
$refund_result = $this->wxpay_refund($transaction_id,$out_refund_no,$money,$money,$reason);
$refund_result = $this->wxpay_refund($orderInfo, $transaction_id,$out_refund_no,$money*100,$money*100,$reason,$reason_id);
}
// 支付宝
if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) {
$refund_result = $this->alipay_refund($transaction_id,$order_sn,$money,$reason);
$refund_result = $this->alipay_refund($orderInfo, $transaction_id,$order_sn,$money,$reason,$reason_id);
}
return $refund_result;
}
... ... @@ -1001,7 +889,7 @@ class ThirdsendController extends HomeBaseController
* @param agencyInfo 中介报价信息
* @param reason 退款原因
*/
private function agency_order_refund($agencyInfo,$reason) {
public function agency_order_refund($agencyInfo,$reason,$reason_id) {
$order_model = new OrderModel();
$where = [
'user_id' => $agencyInfo['agency_id'],
... ... @@ -1012,18 +900,20 @@ class ThirdsendController extends HomeBaseController
];
// 根据不同订单类型执行退款操作
$orderInfo = $order_model->where($where)->find();
$orderInfo['user_type'] = $agencyInfo['user_type'];
$transaction_id = $orderInfo['transaction_id'];
$order_sn = $orderInfo['order_sn'];
$money = $orderInfo['money'];
// $money = $orderInfo['money'];
$money = 0.01;
$out_refund_no = cmf_get_order_sn();
$refund_result = false;
// 微信
if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) {
$refund_result = $this->wxpay_refund($transaction_id,$out_refund_no,$money,$money,$reason);
$refund_result = $this->wxpay_refund($orderInfo, $transaction_id,$out_refund_no,$money*100,$money*100,$reason,$reason_id);
}
// 支付宝
if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) {
$refund_result = $this->alipay_refund($transaction_id,$order_sn,$money,$reason);
$refund_result = $this->alipay_refund($orderInfo, $transaction_id,$order_sn,$money,$reason,$reason_id);
}
return $refund_result;
}
... ... @@ -1036,7 +926,64 @@ class ThirdsendController extends HomeBaseController
* @param refund_reason 退款原因
* @param out_request_no 如需部分退款,传此参数
*/
private function alipay_refund($trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason, $out_request_no = null) {
private function alipay_refund($orderInfo, $trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason,$reason_id, $out_request_no = null) {
$refund = controller('Alipay','controller');
$data = [
'trade_no' => $trade_no,
'out_trade_no' => $out_trade_no,
'refund_amount' => $refund_amount,
'refund_reason' => $refund_reason,
'out_request_no' => $out_request_no
];
$result = $refund->refund($data);
$refund_model = new RefundModel();
if($result->code == '10000' && $result->msg == 'Success') {
$insert = [
'order_id' => $orderInfo['id'],
'order_sn' => $result->out_trade_no,
'user_id' => $orderInfo['user_id'],
'user_type' => $orderInfo['user_type'],
'refund_id' => $result->trade_no,
'pay_type' => 2,
'status' => 2,
'reason' => $reason_id,
'create_time' => time(),
'update_time' => time(),
'refund_time' => strtotime($result->gmt_refund_pay),
'more' => json_encode($result)
];
$refund_result = $refund_model->insertGetId($insert);
if(!$refund_result) {
return false;
}
return true;
} else {
$insert = [
'order_id' => $orderInfo['id'],
'user_id' => $orderInfo['user_id'],
'user_type' => $orderInfo['user_type'],
'pay_type' => 2,
'status' => 4,
'reason' => $reason_id,
'create_time' => time(),
'update_time' => time(),
'refund_time' => time(),
'more' => json_encode($result)
];
$refund_model->insertGetId($insert);
return false;
}
}
/**
* 支付宝退款查询接口(两个订单号不能同时为空)
* @param trade_no 支付宝交易号
* @param out_trade_no 商户支付订单号
* @param refund_amount 退款金额
* @param refund_reason 退款原因
* @param out_request_no 如需部分退款,传此参数
*/
private function alipay_refundquery($trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason, $out_request_no = null) {
$refund = controller('Alipay','controller');
$data = [
'trade_no' => $trade_no,
... ... @@ -1050,19 +997,153 @@ class ThirdsendController extends HomeBaseController
/**
* 微信退款接口(两个订单号不能同时为空)
* @param orderInfo 支付订单信息
* @param transaction_id 微信业务订单号
* @param out_refund_no 商户退款订单号
* @param total_fee 订单金额
* @param refund_fee 退款金额
* @param refund_desc 退款原因
*/
private function wxpay_refund($transaction_id = null, $out_refund_no = null, $total_fee, $refund_fee, $refund_desc) {
private function wxpay_refund($orderInfo, $transaction_id = null, $out_refund_no = null, $total_fee, $refund_fee, $refund_desc,$reason_id) {
require_once VENDOR_PATH.'WxpayAPI/WxRefund.php';
$refund = new \WxRefund(Config::get('wx_appid'),Config::get('wx_mch_id'),Config::get('wx_key'),$transaction_id,
$out_refund_no,$total_fee,$refund_fee,$refund_desc);
return $refund->pay();
$result = $refund->pay();
if($result['return_code'] == 'SUCCESS' && $result['return_msg'] == 'OK') {
$refund_model = new RefundModel();
// $refund = $refund_model->where(['order_sn'=>$result['out_refund_no_0']])->find();
// if(!empty($refund)) {
// return $this->wxpay_refundquery($transaction_id, $out_refund_no, $out_refund_no, $refund['refund_id']);
// }
if($result['result_code'] == 'SUCCESS') {
$insert = [
'order_id' => $orderInfo['id'],
'order_sn' => $result['out_refund_no'],
'user_id' => $orderInfo['user_id'],
'user_type' => $orderInfo['user_type'],
'refund_id' => $result['refund_id'],
'pay_type' => 1,
'reason' => $reason_id,
'create_time' => time(),
'update_time' => time()
];
$refund_result = $refund_model->insertGetId($insert);
if(!$refund_result) {
return false;
}
}
// return $this->wxpay_refundquery($transaction_id, $out_refund_no, $result['out_refund_no'], $insert['refund_id']);
} else {
Db::name('Test')->insert(['data'=>$result['return_msg']]);
return false;
}
}
/**
* 微信退款查询接口(四个订单号不能同时为空)
* @param transaction_id 微信业务订单号
* @param out_trade_no 商户退款订单号
* @param out_refund_no 商户退款订单号
* @param refund_id 微信退款单号
*/
private function wxpay_refundquery($transaction_id = null, $out_trade_no = null, $out_refund_no = null, $refund_id = null) {
require_once VENDOR_PATH.'WxpayAPI/WxRefundQuery.php';
$refund = new \WxRefundQuery(Config::get('wx_appid'),Config::get('wx_mch_id'),Config::get('wx_key'),$transaction_id,
$out_trade_no,$out_refund_no,$refund_id);
$result = $refund->pay();
$refund_model = new RefundModel();
$refund = $refund_model->where(['refund_id'=>$result['refund_id_0']])->find();
if($refund['status'] == 2) {
return true;
}
if($result['return_code'] == 'SUCCESS' && $result['return_msg'] == 'OK') {
Db::startTrans();
$refund_success_time = 0;
if(!empty($result['refund_success_time_0'])) {
$refund_success_time = strtotime($result['refund_success_time_0']);
}
$refund_update = [
'status' => 2,
'update_time' => time(),
'refund_time' => $refund_success_time
];
$refund_result = $refund_model->where(['id'=>$refund['id']])->update($refund_update);
if(!$refund_result) {
Db::rollback();
return false;
}
$order_model = new OrderModel();
$order_update = [
'status' => 4,
'update_time' => time(),
'refund_time' => $refund_success_time
];
$order_result = $order_model->where(['id'=>$refund['order_id']])->update($order_update);
if(!$order_result) {
Db::rollback();
return false;
}
Db::commit();
} else {
$refund_update = [
'status' => 5,
'update_time' => time(),
'remark' => $result['return_msg']
];
$refund_result = $refund_model->where(['id'=>$refund['id']])->update($refund_update);
return false;
}
}
// 发布需求,匹配中介(暂未调用)
public function sendNeed($need_id){
header("Content-Type: text/html;charset=utf-8");
$where_need['id'] = $need_id;
$where_need['status'] = 3;
$need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters")->find();
$final_arr = array();
$code = 'SMS_137674888';
$where_member['type'] = 2;
$where_member['status'] = array('neq','8,9');
// 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配)
$member_find = Db::name('Member')->where($where_member)->field("id,name,tel,city,quarters")->select()->toArray();
foreach ($member_find as $mek=>$mev){
if($need_list['city'] == $mev['city']){
$quarters = explode('+',$mev['quarters']);
foreach ($quarters as $quak=>$quav){
if(strstr($need_list['quarters'],$quav) !== false){
$final_arr[] = $mev;
$final_tel[] = $mev['tel'];
$middle_arr['name'] = $mev['name'];
$middle_arr['name2'] = $need_list['quarters'];
$final_mes[] = $middle_arr;
$final_autograph[] = '比房价';
}
}
}
}
$json_tel = json_encode($final_tel,JSON_UNESCAPED_UNICODE);
$json_mes = json_encode($final_mes,JSON_UNESCAPED_UNICODE);
$json_autograph = json_encode($final_autograph,JSON_UNESCAPED_UNICODE);
$res_mes = $this->sendLogin($json_tel,$code,$json_mes,$json_autograph);
if($res_mes != 'OK'){
$this->apiResponse('0',$res_mes);
}
}
// 短信验证码
public function sendLogin($tel,$code,$modelVal,$json_autograph){
require_once VENDOR_PATH."aliyun-dysms-php-sdk/api_demo/SmsDemo.php";
set_time_limit(0);
header('Content-Type: text/plain; charset=utf-8');
$response = SmsDemo::sendBatchSms($tel,$code,$modelVal,$json_autograph);
return $response;
}
}
... ...
... ... @@ -742,6 +742,7 @@ class UserController extends CommonController
$add_final = Db::name('Card')->where($where_add)->update($add);
if($add_final){
$final['card_id'] = $add_final;
$final['user'] = $user;
$this->apiResponse('1','成功',$final);
}else{
$this->apiResponse('0','添加失败');
... ... @@ -758,6 +759,7 @@ class UserController extends CommonController
$bank = Db::name('Bank')->where($where_bank)->order('score desc,create_time desc')->select();
$final['bank'] = $bank;
$final['card'] = $cardFind;
$final['user'] = $user;
if($cardFind){
$this->apiResponse('1','成功',$final);
}else{
... ... @@ -865,14 +867,19 @@ class UserController extends CommonController
$member = $this->myleft($token);
$data = $request->param();
$page = $data['page']?$data['page']:1;
$size = 2;
$final['user'] = $member;
$where_userNeed['user_id'] = $member['id'];
$where_userNeed['status'] = array('neq',9);
$user_need = Db::name('UserNeed')->where($where_userNeed)
->order('create_time desc')
->limit($size)
->page($page)
->select()->toArray();
$all_page = Db::name('UserNeed')->where($where_userNeed)
->order('create_time desc')
->count();
if($user_need){
foreach ($user_need as $unk=>$unv){
$where_comment['need_id'] = $unv['id'];
... ... @@ -900,6 +907,7 @@ class UserController extends CommonController
$final['user_need'] = array();
}
$final['user'] = $member;
$final['all_page'] = ceil($all_page/$size);
$this->apiResponse('1','成功',$final);
}
... ... @@ -1053,7 +1061,7 @@ class UserController extends CommonController
/**
* @title 确认成交(sure)
* @title 用户选择中介(sure)
* @description 接口说明
* @author 开发者
* @url /api/portal/User/sureAgency
... ... @@ -1074,10 +1082,12 @@ class UserController extends CommonController
if(!$user_need){
$this->apiResponse('0','状态错误');
}
Db::startTrans();
$need_update['status'] = 7;
$need_update['next_choose_time'] = time();
$need_res = Db::name('UserNeed')->where($where_need)->update($need_update);
if(!$need_res){
Db::rollback();
$this->apiResponse('0','成交失败');
}
$where_bid['need_id'] = $data['need_id'];
... ... @@ -1088,19 +1098,37 @@ class UserController extends CommonController
$where_ag['id'] = $data['intermediary_id'];
$add['status'] = 5;
$add['update_time'] = time();
$add['count_deal'] = $is_isset['count_deal']+1;
$need_update['choose_time'] = time();
$save = Db::name('Agency')->where($where_ag)->update($add);
if($save){
$where_unchoose = [
'a.need_id' => $data['need_id'],
'a.id' => ['neq',$data['intermediary_id']]
];
$agency_unchoose = Db::name('Agency')->alias('a')
->where($where_unchoose)
->join("hp_Member m", 'm.id = a.agency_id')
->field('a.*,m.company,m.type as user_type')->select()->toArray();
$thirdsend = controller('Thirdsend','controller');
foreach ($agency_unchoose as $k=>$v) {
$thirdsend->agency_order_refund($v,'中介复选未中标退款',4);
}
Db::commit();
$this->apiResponse('1','确认成功');
}else{
Db::rollback();
$this->apiResponse('0','成交失败');
}
}else{
Db::rollback();
$this->apiResponse('0','报价选择有误');
}
}
/**
* @title 查看评价(sure)
* @description 接口说明
... ... @@ -1179,16 +1207,16 @@ class UserController extends CommonController
if($change_com){
$this->apiResponse('1','评价成功',$add_result);
}else{
$this->apiResponse('0','评价失败');
$this->apiResponse('0','评价失败1');
}
}else{
$this->apiResponse('0','评价失败');
$this->apiResponse('0','评价失败2');
}
}else{
$this->apiResponse('0','评价失败');
$this->apiResponse('0','评价失败3');
}
}else{
$this->apiResponse('0','评价失败');
$this->apiResponse('0','评价失败4');
}
}
... ... @@ -1260,6 +1288,8 @@ class UserController extends CommonController
}
$where_find['n.id'] = $data['need_id'];
$where_find['a.id'] = $data['intermediary_id'];
$where_find['n.status'] = array('in','7,10,11');
$where_find['a.status'] = 5;
$find = Db::name('UserNeed')->alias('n')
->where($where_find)
->join("Agency a",'a.need_id = n.id')
... ...
... ... @@ -104,7 +104,7 @@ class UserneedController extends CommonController
*/
public function send(Request $request)
{
// header("Access-Control-Allow-Origin: *");
Db::startTrans();
if($request->Post('token') && $request->Post('name')){
// $data = $request->param();
// 判空,处理
... ... @@ -134,6 +134,7 @@ class UserneedController extends CommonController
if($elsemoney){
$data['pay_money'] = $elsemoney['money'];
}else{
Db::rollback();
$this->apiResponse('0','保证金获取失败');
}
}else{
... ... @@ -151,8 +152,10 @@ class UserneedController extends CommonController
if($save){
$final['userNeed_id'] = $model->getLastInsID();
Db::commit();
$this->apiResponse('1','添加成功',$final);
}else{
Db::rollback();
$this->apiResponse('0','添加失败');
}
}else{
... ...
... ... @@ -10,7 +10,9 @@
// +----------------------------------------------------------------------
namespace app\portal\controller;
use app\admin\model\ThemeModel;
use app\portal\model\CooperationModel;
use app\portal\model\PortalPostModel;
use cmf\controller\AdminBaseController;
use app\portal\model\PortalTagModel;
use app\portal\service\PostService;
... ... @@ -145,4 +147,41 @@ class CooperationController extends AdminBaseController
}
}
// 两分钟视频
public function video(){
if ($this->request->isPost()) {
$data = $this->request->param();
if (!empty($data['file_names']) && !empty($data['file_urls'])) {
$data['post']['more']['files'] = [];
foreach ($data['file_urls'] as $key => $url) {
$fileUrl = cmf_asset_relative_url($url);
$first = str_split($fileUrl,4);
if($first[0] == 'http'){
$add['path'] = $fileUrl;
}else{
$add['path'] = cmf_get_asset_url($fileUrl);
}
$add['update_time'] = time();
$where_change['id'] = 1;
$res = Db::name('Video')->where($where_change)->update($add);
if($res){
$this->success('修改成功',url('Cooperation/video'));
}else{
$this->error('添加失败');
}
}
}else{
$this->error('视频不能为空');
}
}else{
$where_status['status'] = 1;
$video = Db::name('Video')->where($where_status)->find();
$this->assign('video',$video);
return $this->fetch();
}
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use cmf\controller\AdminBaseController;
use think\Db;
use think\Loader;
use think\Request;
class RefundController extends AdminBaseController
{
// 提现申请
public function index(){
$data = $this->request->param();
if($data){
$startTime = empty($data['start_time']) ? 0 : strtotime($data['start_time']);
$endTime = empty($data['end_time']) ? 0 : strtotime($data['end_time']);
if ($startTime && $endTime) {
$where_money['r.create_time'] = array('between',"$startTime,$endTime");
$this->assign('start_time', $data['start_time']);
$this->assign('end_time', $data['end_time']);
}else{
if($startTime){
$where_money['r.create_time'] = array('egt',$startTime);
$this->assign('start_time', $data['start_time']);
}
if($endTime){
$where_money['r.create_time'] = array('elt',$endTime);
$this->assign('end_time', $data['end_time']);
}
}
if(!empty($data['name'])){
$where_money['m.name'] = array('like','%'.$data['name'].'%');
$this->assign('name', $data['name']);
}
if(!empty($data['tel'])){
$where_money['m.tel'] = array('like','%'.$data['tel'].'%');
$this->assign('tel', $data['tel']);
}
}
$where_money['r.status'] = array('neq',9);
$money_list = Db::name('Refund')->alias('r')
->join("Member m",'m.id = r.user_id')
->where($where_money)
->field("m.name,m.tel,r.*")
->paginate();
$page = $money_list->render();
$this->assign('page',$page);
$this->assign('lists',$money_list);
return $this->fetch('index');
}
// 同意投诉
public function agree(){
$data = $this->request->param();
$where_money['id'] = $data['id'];
$where_money['status'] = array('neq',9);
$money = Db::name('Complaint')->where($where_money)->find();
if($money){
$save['status'] = 2;
$save['update_time'] = time();
$update = Db::name('Complaint')->where($where_money)->update($save);
if($update){
$this->success('成功');
}else{
$this->error('失败');
}
}else{
$this->error('投诉状态不正确');
}
}
// 拒绝投诉
public function refuse(){
$data = $this->request->param();
$where_money['id'] = $data['id'];
$where_money['status'] = array('neq',9);
$money = Db::name('Complaint')->where($where_money)->find();
if($money){
$save['status'] = 3;
$save['update_time'] = time();
$update = Db::name('Complaint')->where($where_money)->update($save);
if($update){
$where_need['id'] = $money['need_id'];
$where_need['status'] = array('neq',9);
$findNeed = Db::name('UserNeed')->where($where_need)->find();
$needTime = ($findNeed['next_choose_time']+259200)-$findNeed['complaint_time'];
$change_need['refuse_complaint_time'] = time()+$needTime;
$change_need['status'] = 14;
$saveNeed = Db::name('UserNeed')->where($where_need)->update($change_need);
if(!$saveNeed){
$this->error('拒绝失败');
}
$where_agency['id'] = $money['intermediary_id'];
$where_agency['status'] = array('neq',9);
$findAgency = Db::name('UserNeed')->where($where_agency)->find();
$agencyTime = ($findAgency['choose_time']+259200)-$findAgency['complaint_time'];
$change_agency['refuse_complaint_time'] = time()+$agencyTime;
$change_agency['status'] = 14;
$saveAgency = Db::name('UserNeed')->where($where_agency)->update($change_agency);
if(!$saveAgency){
$this->error('拒绝失败');
}
$this->success('成功');
}else{
$this->error('失败');
}
}else{
$this->error('订单状态不正确');
}
}
/**
* 后台删除第三方用户绑定
* @adminMenu(
* 'name' => '删除第三方用户绑定',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '删除第三方用户绑定',
* 'param' => ''
* )
*/
public function delete()
{
$id = input('param.id', 0, 'intval');
if (empty($id)) {
$this->error('非法数据!');
}
Db::name("third_party_user")->where("id", $id)->delete();
$this->success("删除成功!", "admin_oauth/index");
}
}
\ No newline at end of file
... ...
... ... @@ -45,7 +45,7 @@ class StatisticsController extends AdminBaseController
// 列表
// 注册
public function index(Request $request)
{
return $this->fetch('index');
... ... @@ -123,4 +123,364 @@ class StatisticsController extends AdminBaseController
}
// 缴纳金额
public function money(Request $request)
{
return $this->fetch();
}
public function findmoney(){
$data = $this->request->param();
foreach ($data['time'] as $tk=>$tv){
$time[$tk]['start_time'] = strtotime($tv);
$time[$tk]['end_time'] = strtotime($tv)+86400;
}
$start_time = '';
$end_time = '';
// 用户
$where_member['status'] = array('neq','1,9');
$all_member = Db::name('UserNeed')
// ->alias('n')
// ->join('Member m','m.id = n.user_id')
->where($where_member)
->field('pay_money,pay_time,status')
->select()->toArray();
// 中介
$where_agency['status'] = array('neq','1,9');
$all_agency = Db::name('Agency')
// ->alias('a')
// ->join('Member m','m.id = a.user_id')
->where($where_agency)
->field('deposit,pay_time,status')
->select()->toArray();
$pie_user = 0;
$pie_member = 0;
// 筛选时间判断
if(!empty($data['start_time']) || !empty($data['end_time'])) {
// 搜索
if (!empty($data['start_time'])) {
$start_time = strtotime($data['start_time']);
}
if (!empty($data['end_time'])) {
$end_time = strtotime($data['end_time']);
}
}else{
// 默认
$date_str = date('Y-m-d',time());
$date_time = strtotime($date_str);
$end_time = time();
$start_time = $date_time;
}
// 筛选状态
if(!empty($data['status'])){
// 进行中
if($data['status'] == 1){
$userStatus = array('2','3','4','5','6','7','8','12','13','14');
$agencyStatus = array('2','3','4','5','6','7','8','10','12','13','14');
}
// 已成交
if($data['status'] == 2){
$userStatus = array('10','11');
$agencyStatus = array('11');
}
}else{
$userStatus = array('2','3','4','5','6','7','8','10','11','12','13','14') ;
$agencyStatus = array('2','3','4','5','6','7','8','10','11','12','13','14') ;
}
// 用户饼状图
foreach ($all_member as $mk => $mv) {
if ($mv['pay_time'] >= $start_time && $mv['pay_time'] <= $end_time) {
if(in_array($mv['status'],$userStatus)){
$pie_user += $mv['pay_money'];
}
}
}
// 中介饼状图
foreach ($all_agency as $ak => $av) {
if ($av['pay_time'] >= $start_time && $av['pay_time'] <= $end_time) {
if(in_array($av['status'],$agencyStatus)){
$pie_member += $av['deposit'];
}
}
}
// 用户柱状图
foreach ($time as $timekF=>$timevF){
$user_add = 0;
// $member_add = 0;
foreach ($all_member as $memberk=>$memberv){
// 判断时间
if($memberv['pay_time'] >=$timevF['start_time'] && $memberv['pay_time'] <=$timevF['end_time']){
$user_add += $memberv['pay_money'];
}
}
$user[] = $user_add;
}
// 中介柱状图
foreach ($time as $timek=>$timev){
$member_add = 0;
foreach ($all_agency as $agencyk=>$agencyv){
// 判断时间
if($agencyv['pay_time'] >=$timev['start_time'] && $agencyv['pay_time'] <=$timev['end_time']){
//
$member_add += $agencyv['deposit'];
}
}
$member[] = $member_add;
}
$final['user'] = $user;
$final['member'] = $member;
$final['start_time'] = $start_time;
$final['end_time'] = $end_time;
$final['pie_user'] = $pie_user;
$final['pie_member'] = $pie_member;
$this->apiResponse('1','成功',$final);
}
// 提现
public function cash(Request $request)
{
return $this->fetch();
}
public function findcash(){
// 注册人数
$data = $this->request->param();
foreach ($data['time'] as $tk=>$tv){
$time[$tk]['start_time'] = strtotime($tv);
$time[$tk]['end_time'] = strtotime($tv)+86400;
}
$start_time = '';
$end_time = '';
$where_member['status'] = array('neq',9);
$where_member['type'] = 3;
$all_member = Db::name('MoneyDetail')->where($where_member)->field('user_type,money,create_time')
->select()->toArray();
$pie_user = 0;
$pie_member = 0;
// 筛选时间判断
if(!empty($data['start_time']) || !empty($data['end_time'])) {
// 搜索
if (!empty($data['start_time'])) {
$start_time = strtotime($data['start_time']);
}
if (!empty($data['end_time'])) {
$end_time = strtotime($data['end_time']);
}
}else{
// 默认
$date_str = date('Y-m-d',time());
$date_time = strtotime($date_str);
$end_time = time();
$start_time = $date_time;
}
// 饼状图
foreach ($all_member as $mk => $mv) {
if ($mv['create_time'] >= $start_time && $mv['create_time'] <= $end_time) {
if ($mv['user_type'] == 1) {
$pie_user += $mv['money'];
} else {
$pie_member += $mv['money'];
}
}
}
// 柱状图
foreach ($time as $timek=>$timev){
$user_add = 0;
$member_add = 0;
foreach ($all_member as $memberk=>$memberv){
// 判断时间
if($memberv['create_time'] >=$timev['start_time'] && $memberv['create_time'] <=$timev['end_time']){
// 判断类型
if($memberv['user_type'] == 1){
$user_add += $memberv['money'];
}else{
$member_add += $memberv['money'];
}
}
}
$user[] = $user_add;
$member[] = $member_add;
}
$final['user'] = $user;
$final['member'] = $member;
$final['start_time'] = $start_time;
$final['end_time'] = $end_time;
$final['pie_user'] = $pie_user;
$final['pie_member'] = $pie_member;
$this->apiResponse('1','成功',$final);
}
// 奖励
public function getmoney(Request $request)
{
return $this->fetch();
}
public function findgetmoney(){
// 注册人数
$data = $this->request->param();
foreach ($data['time'] as $tk=>$tv){
$time[$tk]['start_time'] = strtotime($tv);
$time[$tk]['end_time'] = strtotime($tv)+86400;
}
$start_time = '';
$end_time = '';
$where_member['status'] = array('neq',9);
$where_member['order_type'] = 7;
$all_member = Db::name('MoneyDetail')->where($where_member)->field('user_type,money,create_time')
->select()->toArray();
$pie_user = 0;
$pie_member = 0;
// 筛选时间判断
if(!empty($data['start_time']) || !empty($data['end_time'])) {
// 搜索
if (!empty($data['start_time'])) {
$start_time = strtotime($data['start_time']);
}
if (!empty($data['end_time'])) {
$end_time = strtotime($data['end_time']);
}
}else{
// 默认
$date_str = date('Y-m-d',time());
$date_time = strtotime($date_str);
$end_time = time();
$start_time = $date_time;
}
// 饼状图
foreach ($all_member as $mk => $mv) {
if ($mv['create_time'] >= $start_time && $mv['create_time'] <= $end_time) {
if ($mv['user_type'] == 1) {
$pie_user += $mv['money'];
} else {
$pie_member += $mv['money'];
}
}
}
// 柱状图
foreach ($time as $timek=>$timev){
$user_add = 0;
$member_add = 0;
foreach ($all_member as $memberk=>$memberv){
// 判断时间
if($memberv['create_time'] >=$timev['start_time'] && $memberv['create_time'] <=$timev['end_time']){
// 判断类型
if($memberv['user_type'] == 1){
$user_add += $memberv['money'];
}else{
$member_add += $memberv['money'];
}
}
}
$user[] = $user_add;
$member[] = $member_add;
}
$final['user'] = $user;
$final['member'] = $member;
$final['start_time'] = $start_time;
$final['end_time'] = $end_time;
$final['pie_user'] = $pie_user;
$final['pie_member'] = $pie_member;
$this->apiResponse('1','成功',$final);
}
// 透视卡
public function elseMoney(Request $request)
{
return $this->fetch();
}
public function findelse(){
// 注册人数
$data = $this->request->param();
foreach ($data['time'] as $tk=>$tv){
$time[$tk]['start_time'] = strtotime($tv);
$time[$tk]['end_time'] = strtotime($tv)+86400;
}
$start_time = '';
$end_time = '';
$where_member['status'] = array('neq',9);
$where_member['order_type'] = 8;
$all_member = Db::name('MoneyDetail')->where($where_member)->field('user_type,money,create_time')
->select()->toArray();
$pie_user = 0;
$pie_member = 0;
// 筛选时间判断
if(!empty($data['start_time']) || !empty($data['end_time'])) {
// 搜索
if (!empty($data['start_time'])) {
$start_time = strtotime($data['start_time']);
}
if (!empty($data['end_time'])) {
$end_time = strtotime($data['end_time']);
}
}else{
// 默认
$date_str = date('Y-m-d',time());
$date_time = strtotime($date_str);
$end_time = time();
$start_time = $date_time;
}
// 饼状图
foreach ($all_member as $mk => $mv) {
if ($mv['create_time'] >= $start_time && $mv['create_time'] <= $end_time) {
if ($mv['user_type'] == 1) {
$pie_user += $mv['money'];
} else {
$pie_member += $mv['money'];
}
}
}
// 柱状图
foreach ($time as $timek=>$timev){
$user_add = 0;
$member_add = 0;
foreach ($all_member as $memberk=>$memberv){
// 判断时间
if($memberv['create_time'] >=$timev['start_time'] && $memberv['create_time'] <=$timev['end_time']){
// 判断类型
if($memberv['user_type'] == 1){
$user_add += $memberv['money'];
}else{
$member_add += $memberv['money'];
}
}
}
$user[] = $user_add;
$member[] = $member_add;
}
$final['user'] = $user;
$final['member'] = $member;
$final['start_time'] = $start_time;
$final['end_time'] = $end_time;
$final['pie_user'] = $pie_user;
$final['pie_member'] = $pie_member;
$this->apiResponse('1','成功',$final);
}
}
... ...
... ... @@ -161,17 +161,23 @@ return array (
'PORTAL_COMPLAINT_INDEX' => '投诉管理',
'PORTAL_COOPERATION_DEFAULT' => '首页内容管理',
'PORTAL_COOPERATION_INDEX' => '合作企业列表',
'PORTAL_COOPERATION_VIDEO' => '两分钟视频',
'PORTAL_NEED_INDEX' => '需求管理',
'PORTAL_NEED_USER' => '需求管理',
'PORTAL_NEW_INDEX' => '最新成交公布',
'PORTAL_PROCESS_INDEX' => '交易流程',
'PORTAL_REFUND_INDEX' => '退款管理',
'PORTAL_REWARD_DEFAULT' => '推广奖励设置',
'PORTAL_REWARD_EARNEST' => '缴纳诚意金后奖励设置',
'PORTAL_REWARD_INDEX' => '信誉奖励设置',
'PORTAL_SHARE_CONTENT' => '分享内容管理',
'PORTAL_SHARE_DEFAULT' => '分享内容管理',
'PORTAL_SHARE_PIC' => '图片管理',
'PORTAL_STATISTICS_INDEX' => '统计',
'PORTAL_STATISTICS_CASH' => '提现金额统计',
'PORTAL_STATISTICS_DEFAULT' => '统计',
'PORTAL_STATISTICS_ELSEMONEY' => '透视卡金额统计',
'PORTAL_STATISTICS_GETMONEY' => '奖励金额统计',
'PORTAL_STATISTICS_INDEX' => '注册统计',
'PORTAL_STATISTICS_MONEY' => '缴纳金额统计',
'PORTAL_USERNEED_DEFAULT' => '发布需求管理',
'PORTAL_USERNEED_INDEX' => '保证金内容管理',
'USER_ADMINASSET_DELETE' => '删除文件',
... ...
... ... @@ -796,7 +796,7 @@ function openUploadDialog(dialog_title, callback, extra_params, multi, filetype,
if (typeof callback == 'function') {
var iframewindow = this.iframe.contentWindow;
var files = iframewindow.get_selected_files();
console.log(files);
// console.log(files);
if (files && files.length > 0) {
callback.apply(this, [this, files, extra_params]);
} else {
... ...
<include file="public@header"/>
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
<script type="text/html" id="files-item-tpl">
<li id="saved-file{id}">
<input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
<input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{filepath}"
style="width: 200px;" title="文件名称">
<a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
</li>
</script>
</head>
<body>
<div class="wrap js-check-wrap">
<form action="{:url('Cooperation/video')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<tr>
<th>附件</th>
<td>
<ul id="files" class="pic-list list-unstyled form-inline">
<li id="saved-file1">
<input id="file-1" type="hidden" name="file_urls[]"
value="{$video.path}">
<input class="form-control" id="file-1-name" type="text"
name="file_names[]"
value="{$video.path}" style="width: 200px;" title="图片名称">
<a href="javascript:(function(){$('#saved-file1').remove();})();">移除</a>
</li>
</ul>
<a href="javascript:uploadMultiFile('附件上传','#files','files-item-tpl','file');"
class="btn btn-sm btn-default">选择文件</a>
</td>
</tr>
</table>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
$('#more-template-select').val("{$post.more.template|default=''}");
});
</script>
</body>
</html>
... ...
<include file="public@header"/>
<link rel="stylesheet" href="__STATIC__/install/css/mdialog.css">
<style>
.popup,.popdown{
width: 250px;
height: 100px;
background-color: rgba(0,0,0,0.5);
position: fixed;
top: 50%;
transform: translateY(-50px);
left: 0;
right: 0;
margin: 0 auto;
border-radius: 5px;
color: #ffffff;
}
.popup p,.popdown p{
text-align: center;
margin-top: 20px;
}
.popup span,.popdown span{
text-align: center;
line-height: 30px;
cursor: pointer;
}
.popup .queding,.popdown .sure{
display: inline-block;
width: 80px;
height: 30px;
background-color: #1E9FFF;
border-radius: 3px;
}
.popup span:hover,.popdown span:hover{
opacity: 0.8;
}
.popup .quxiao,.popdown .re{
display: inline-block;
width: 80px;
height: 30px;
ckground-color: #9cb945 ;
color: #333333;
border-radius: 3px;
background-color:#fff;
margin-left: 35px;
}
.btn_list{
margin: 0 auto;
width: 200px;
}
</style>
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<li class="active"><a>投诉管理</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Complaint/index')}">
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off"> -
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
用户名:
<input type="text" class="form-control" name="name" style="width: 200px;"
value="{$name|default=''}" placeholder="请输入姓名">
手机号:
<input type="text" class="form-control" name="tel" style="width: 200px;"
value="{$tel|default=''}" placeholder="请输入手机号">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Refund/index')}">清空</a>
<!--<span class="btn btn-default" onclick="window.history.back(-1)" >返回</span>-->
</form>
<form method="post" class="js-ajax-form margin-top-20">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>ID</th>
<th>用户id</th>
<th>用户名</th>
<th>手机号</th>
<th>类型</th>
<th>退款金额</th>
<th>退款单号</th>
<th>退款方式</th>
<th>退款原因</th>
<th>退款时间</th>
<th>退款成功时间</th>
<th>状态</th>
<!--<th>操作</th>-->
</tr>
</thead>
<tbody>
<foreach name="lists" item="vo">
<tr>
<td>{$vo.id}</td>
<td>{$vo.user_id}</td>
<td>{$vo.name}</td>
<td>{$vo.tel}</td>
<td>
<eq name="vo.user_type" value="1">
用户
</eq>
<eq name="vo.user_type" value="2">
中介
</eq>
</td>
<td>{$vo.money}</td>
<td>{$vo.refund_id}</td>
<td>
<eq name="vo.pay_type" value="1">
支付宝
</eq>
<eq name="vo.pay_type" value="2">
微信
</eq>
</td>
<td>
<eq name="vo.reason" value="1">
报价人数不足
</eq>
<eq name="vo.reason" value="2">
用户未选择
</eq>
<eq name="vo.reason" value="3">
用户未确认
</eq>
<eq name="vo.reason" value="4">
中介未确认
</eq>
</td>
<td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
<td>{:date('Y-m-d H:i:s',$vo['refund_time'])}</td>
<td>
<eq name="vo.status" value="1">
<span index="{$vo.id}" style="color: #858585">退款处理中</span>
</eq>
<eq name="vo.status" value="2">
<span index="{$vo.id}" style="color: #858585">退款成功</span>
</eq>
<eq name="vo.status" value="3">
<span index="{$vo.id}" style="color: #858585">退款关闭</span>
</eq>
<eq name="vo.status" value="4">
<span index="{$vo.id}" style="color: #858585">退款异常</span>
</eq>
</td>
</tr>
</foreach>
</tbody>
</table>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript" src="__STATIC__/js/zepto.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/mdialog.js"></script>
<script type="">
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
<meta charset="utf-8">
<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* css 代码 */
</style>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
<script src="__STATIC__/js/highcharts.js"></script>
</head>
<body>
<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
<div class="well form-inline margin-top-20" >
时间:
<input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off">
<input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
<a class="btn btn-danger" href="{:url('Statistics/cash')}">清空</a>
</div>
</div>
<div id="container" style="min-width:400px;height:400px">
</div>
<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
<script src="__STATIC__/js/admin.js"></script>
<script>
function all() {
var timeList=[];
var _user=[] ;
var _member=[] ;
var chart ;
var pie_user ;
var pie_member ;
var start_time = $('.start_time').val();
var end_time = $('.end_time').val();
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
for(var i=-4;i<1;i++){
timeList.push(GetDateStr(i))
}
getData();
function getData(){
$.ajax({
type:"POST",
url:"{:url('portal/Statistics/findcash')}",
data:{
"time":timeList,
"start_time":start_time,
"end_time":end_time,
},
success:function (data) {
console.log(data)
_user = Object.assign([],data.data.user);
_member = Object.assign([],data.data.member);
pie_user = data.data.pie_user;
pie_member = data.data.pie_member;
// 图表
chart = Highcharts.chart('container', {
title: {
text: '注册统计图表'
},
xAxis: {
categories: timeList,
crosshair: true
},
plotOptions: {
column: {
pointPadding: 0,
borderWidth: 0
}
},
labels: {
items: [{
html: '即时数据/筛选结果',
style: {
left: '100px',
top: '18px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
}
}]
},
tooltip :{
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.0f} 元</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
series: [{
type: 'column',
name: '用户',
data: _user
}, {
type: 'column',
name: '中介',
data: _member
}, {
type: 'pie',
name: '注册人数',
data: [{
name: '中介',
y: pie_member,
color: Highcharts.getOptions().colors[1] // Jane's color
}, {
name: '用户',
y: pie_user,
color: Highcharts.getOptions().colors[0] // John's color
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
},
error:function () {
alert("网络错误");
}
})
}
}
// 请求获取数据
all();
$('.btn').click(function () {
all();
})
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
<meta charset="utf-8">
<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* css 代码 */
</style>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
<script src="__STATIC__/js/highcharts.js"></script>
</head>
<body>
<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
<div class="well form-inline margin-top-20" >
时间:
<input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off">
<input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
<a class="btn btn-danger" href="{:url('Statistics/elseMoney')}">清空</a>
</div>
</div>
<div id="container" style="min-width:400px;height:400px">
</div>
<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
<script src="__STATIC__/js/admin.js"></script>
<script>
function all() {
var timeList=[];
var _user=[] ;
var _member=[] ;
var chart ;
var pie_user ;
var pie_member ;
var start_time = $('.start_time').val();
var end_time = $('.end_time').val();
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
for(var i=-4;i<1;i++){
timeList.push(GetDateStr(i))
}
getData();
function getData(){
$.ajax({
type:"POST",
url:"{:url('portal/Statistics/findelse')}",
data:{
"time":timeList,
"start_time":start_time,
"end_time":end_time,
},
success:function (data) {
console.log(data)
_user = Object.assign([],data.data.user);
_member = Object.assign([],data.data.member);
pie_user = data.data.pie_user;
pie_member = data.data.pie_member;
// 图表
chart = Highcharts.chart('container', {
title: {
text: '注册统计图表'
},
xAxis: {
categories: timeList,
crosshair: true
},
plotOptions: {
column: {
pointPadding: 0,
borderWidth: 0
}
},
labels: {
items: [{
html: '即时数据/筛选结果',
style: {
left: '100px',
top: '18px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
}
}]
},
tooltip :{
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.0f} 人</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
series: [{
type: 'column',
name: '用户',
data: _user
}, {
type: 'column',
name: '中介',
data: _member
}, {
type: 'pie',
name: '注册人数',
data: [{
name: '中介',
y: pie_member,
color: Highcharts.getOptions().colors[1] // Jane's color
}, {
name: '用户',
y: pie_user,
color: Highcharts.getOptions().colors[0] // John's color
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
},
error:function () {
alert("网络错误");
}
})
}
}
// 请求获取数据
all();
$('.btn').click(function () {
all();
})
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
<meta charset="utf-8">
<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* css 代码 */
</style>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
<script src="__STATIC__/js/highcharts.js"></script>
</head>
<body>
<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
<div class="well form-inline margin-top-20" >
时间:
<input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off">
<input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
<a class="btn btn-danger" href="{:url('Statistics/getmoney')}">清空</a>
</div>
</div>
<div id="container" style="min-width:400px;height:400px">
</div>
<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
<script src="__STATIC__/js/admin.js"></script>
<script>
function all() {
var timeList=[];
var _user=[] ;
var _member=[] ;
var chart ;
var pie_user ;
var pie_member ;
var start_time = $('.start_time').val();
var end_time = $('.end_time').val();
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
for(var i=-4;i<1;i++){
timeList.push(GetDateStr(i))
}
getData();
function getData(){
$.ajax({
type:"POST",
url:"{:url('portal/Statistics/findgetmoney')}",
data:{
"time":timeList,
"start_time":start_time,
"end_time":end_time,
},
success:function (data) {
console.log(data)
_user = Object.assign([],data.data.user);
_member = Object.assign([],data.data.member);
pie_user = data.data.pie_user;
pie_member = data.data.pie_member;
// 图表
chart = Highcharts.chart('container', {
title: {
text: '注册统计图表'
},
xAxis: {
categories: timeList,
crosshair: true
},
plotOptions: {
column: {
pointPadding: 0,
borderWidth: 0
}
},
labels: {
items: [{
html: '即时数据/筛选结果',
style: {
left: '100px',
top: '18px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
}
}]
},
tooltip :{
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.0f} 元</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
series: [{
type: 'column',
name: '用户',
data: _user
}, {
type: 'column',
name: '中介',
data: _member
}, {
type: 'pie',
name: '注册人数',
data: [{
name: '中介',
y: pie_member,
color: Highcharts.getOptions().colors[1] // Jane's color
}, {
name: '用户',
y: pie_user,
color: Highcharts.getOptions().colors[0] // John's color
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
},
error:function () {
alert("网络错误");
}
})
}
}
// 请求获取数据
all();
$('.btn').click(function () {
all();
})
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
<meta charset="utf-8">
<!--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* css 代码 */
</style>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<!--<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>-->
<script src="__STATIC__/js/highcharts.js"></script>
</head>
<body>
<div class="wrap js-check-wrap" style="padding: 20px 20px 0px;">
<div class="well form-inline margin-top-20" >
时间:
<input type="text" class="form-control js-bootstrap-datetime start_time" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime end_time" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off">
状态:
<select name="status" style="border: 1px solid #dce4ec; margin-top: 20px;" class="type">
<option name="status" value="0" >&nbsp; &nbsp;---请选择---</option>
<option name="status" value="1">进行中</option>
<option name="status" value="2">已成交</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" class="btn btn-primary" value="搜索" onclick="getData()"/>
<a class="btn btn-danger" href="{:url('Statistics/money')}">清空</a>
</div>
</div>
<div id="container" style="min-width:400px;height:400px">
</div>
<!--<div id="container1" style="min-width:400px;height:400px"></div>-->
<script src="__STATIC__/js/admin.js"></script>
<script>
function all() {
var timeList=[];
var _user=[] ;
var _member=[] ;
var chart ;
var pie_user ;
var pie_member ;
var pie_all ;
var start_time = $('.start_time').val();
var end_time = $('.end_time').val();
var status = $('.type').val();
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
for(var i=-4;i<1;i++){
timeList.push(GetDateStr(i))
}
getData();
function getData(){
$.ajax({
type:"POST",
url:"{:url('portal/Statistics/findmoney')}",
data:{
"time":timeList,
"start_time":start_time,
"end_time":end_time,
"status":status,
},
success:function (data) {
console.log(data)
_user = Object.assign([],data.data.user);
_member = Object.assign([],data.data.member);
pie_user = data.data.pie_user;
pie_member = data.data.pie_member;
pie_all = data.data.pie_member + data.data.pie_user;
// 图表
chart = Highcharts.chart('container', {
title: {
text: '注册统计图表'
},
xAxis: {
categories: timeList,
crosshair: true
},
plotOptions: {
column: {
pointPadding: 0,
borderWidth: 0
}
},
labels: {
items: [{
html: "即时数据/筛选结果(共"+pie_all+"元)",
style: {
left: '100px',
top: '18px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
}
}]
},
tooltip :{
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.0f} 元</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
series: [{
type: 'column',
name: '用户',
data: _user
}, {
type: 'column',
name: '中介',
data: _member
}, {
type: 'pie',
name: '注册人数',
data: [{
name: '中介',
y: pie_member,
color: Highcharts.getOptions().colors[1] // Jane's color
}, {
name: '用户',
y: pie_user,
color: Highcharts.getOptions().colors[0] // John's color
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
},
error:function () {
alert("网络错误");
}
})
}
}
// 请求获取数据
all();
$('.btn').click(function () {
all();
})
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -42,6 +42,16 @@
</td>
</tr>
<tr>
<th width="15%">中介报价次数</th>
<td><input class="form-control" type="text" name="count_agency" value="{$list['count_agency']}" />
</td>
</tr>
<tr>
<th width="15%">中介已中标次数</th>
<td><input class="form-control" type="text" name="count_deal" value="{$list['count_deal']}" />
</td>
</tr>
<tr>
<th width="15%">城市</th>
<td><input class="form-control" type="text" name="city" value="{$list['city']}" />
</td>
... ...
... ... @@ -684,12 +684,12 @@
uploader.on('uploadError', function (file, reason) {
console.log(file.id);
console.log(reason);
if (reason == 'server') {
$('#' + file.id).find('p.error').text(fileErrorMsg[file.id]);
}
});
uploader.onError = function (code) {
switch (code) {
case "Q_TYPE_DENIED":
... ...
... ... @@ -1282,3 +1282,7 @@
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>'
2018-07-25 15:41:51 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018072556535456"}
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>'
2018-07-31 14:32:48 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018073199499949"}
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>'
2018-07-31 14:33:04 {"product_code":"FAST_INSTANT_TRADE_PAY","body":"","subject":"需求保证金支付","total_amount":"0.01","out_trade_no":"2018073199499949"}
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
}
/**
* 发送短信
* 发送短信,验证码
* @return stdClass
*/
public static function sendSms($tel,$modelCode,$modelVal) {
... ... @@ -101,11 +101,49 @@ class SmsDemo
return $acsResponse;
}
/**
* 发送短信,中介中标
* @return stdClass
*/
public static function sendSmsAgency($tel,$modelVal) {
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendSmsRequest();
//可选-启用https协议
//$request->setProtocol("https");
// 必填,设置短信接收号码
$request->setPhoneNumbers($tel);
// 必填,设置签名名称,应严格按"签名名称"填写,请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/sign
$request->setSignName("比房价");
// 必填,设置模板CODE,应严格按"模板CODE"填写, 请参考: https://dysms.console.aliyun.com/dysms.htm#/develop/template
$request->setTemplateCode('SMS_137960210');
// 可选,设置模板参数, 假如模板中存在变量需要替换则为必填项
$request->setTemplateParam(json_encode(array( // 短信模板中字段的值
"name"=>$modelVal,
), JSON_UNESCAPED_UNICODE));
// 可选,设置流水号
// $request->setOutId("yourOutId");
// 选填,上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
// $request->setSmsUpExtendCode("1234567");
// 发起访问请求
$acsResponse = static::getAcsClient()->getAcsResponse($request);
return $acsResponse;
}
/**
* 批量发送短信
* @return stdClass
*/
public static function sendBatchSms() {
public static function sendBatchSms($tel,$code,$content,$autograph) {
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendBatchSmsRequest();
... ... @@ -114,32 +152,20 @@ class SmsDemo
//$request->setProtocol("https");
// 必填:待发送手机号。支持JSON格式的批量调用,批量上限为100个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
$request->setPhoneNumberJson(json_encode(array(
"1500000000",
"1500000001",
), JSON_UNESCAPED_UNICODE));
$request->setPhoneNumberJson($tel);
// 必填:短信签名-支持不同的号码发送不同的短信签名
$request->setSignNameJson(json_encode(array(
"云通信",
"云通信"
"比房价",
"比房价"
), JSON_UNESCAPED_UNICODE));
// 必填:短信模板-可在短信控制台中找到
$request->setTemplateCode("SMS_1000000");
$request->setTemplateCode($code);
// 必填:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
// 友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败
$request->setTemplateParamJson(json_encode(array(
array(
"name" => "Tom",
"code" => "123",
),
array(
"name" => "Jack",
"code" => "456",
),
), JSON_UNESCAPED_UNICODE));
$request->setTemplateParamJson($content);
// 可选-上行短信扩展码(扩展码字段控制在7位或以下,无特殊需求用户请忽略此字段)
// $request->setSmsUpExtendCodeJson("[\"90997\",\"90998\"]");
... ...