edit-qywhat-robot
This commit is contained in:
@@ -169,8 +169,11 @@ class Xzcall extends HD_Controller
|
||||
public function dorobot()
|
||||
{
|
||||
$o_id = $this->input->get('id');
|
||||
$test = $this->input->get('test');
|
||||
if ($o_id) {
|
||||
$this->load->library('qyrobot');
|
||||
$params = [];
|
||||
$test && $params['test'] = 1;
|
||||
$this->load->library('qyrobot',$params);
|
||||
$robot_res = $this->qyrobot->deposit_notify($o_id);
|
||||
var_dump($robot_res);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ class Wxnotify_v3 extends CI_Controller{
|
||||
$this->load->model('apporder/order_purchase_model','purchase_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
|
||||
$input = file_get_contents('php://input');
|
||||
debug_log("[info] ". __FUNCTION__ . "# input:" . $input, $this->log_file,$this->log_dir);
|
||||
$this->notify_data = json_decode($input,true);
|
||||
@@ -110,7 +112,16 @@ class Wxnotify_v3 extends CI_Controller{
|
||||
$this->load->service('apporder/payment_service', array('app_id' => $this->app_id));
|
||||
$result = $this->payment_service->after_pay_liche($sid,$result['data']['amount']['payer_total']/100);
|
||||
if($result['code']){
|
||||
if($order['type']==1 && $result_data['data']['amount']['payer_total']>=10000){ //支付定金推送企业微信群
|
||||
$is_ts = false;
|
||||
if($order['type']==1){ //定金
|
||||
$is_ts = true;
|
||||
}elseif($order['type']==4){ //意向金
|
||||
$receiver_order = $this->receiver_orders_model->get(['id'=>$order['o_id']]);
|
||||
if($receiver_order['deposit'] == $order['total_price']){
|
||||
$is_ts = true;
|
||||
}
|
||||
}
|
||||
if($is_ts && $result_data['data']['amount']['payer_total']>=10000){ //支付定金和意向金推送企业微信群
|
||||
$this->load->library('qyrobot');
|
||||
$robot_res = $this->qyrobot->deposit_notify($order['o_id']);
|
||||
debug_log("[info] ". __FUNCTION__ . ":推送企业微信群 ".json_encode($robot_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
|
||||
|
||||
@@ -13,9 +13,9 @@ class Qyrobot{
|
||||
|
||||
private $key = 'dfed1a38-c4e0-4904-94eb-306e9755be04'; //正式
|
||||
private $ci;
|
||||
public function __construct(){
|
||||
public function __construct($params=[]){
|
||||
$this->ci = & get_instance();
|
||||
if($_SERVER['CI_ENV'] == 'development'){ //测试环境
|
||||
if($_SERVER['CI_ENV'] == 'development' || $params['test']){ //测试环境
|
||||
$this->key = '0b644923-4e5c-46be-9a87-6dfcb023d09c';
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,13 @@ class Qyrobot{
|
||||
$where['c_time>='] = strtotime(date('Y-m-01 00:00:00'));
|
||||
$month_count = $this->ci->app_liche_orders_model->count($where);//本月成交订单数
|
||||
|
||||
//意向金等于定金的支付订单
|
||||
$sql = "select count(*) as total from lc_app_liche_orders as a left join lc_receiver_orders as b on a.o_id=b.id and a.total_price=b.deposit where a.type=4 and a.status=1 and a.pay_price>=0 and a.c_time>=".strtotime(date('Y-m-d 00:00:00'));
|
||||
$int_query = $this->ci->db->query($sql)->row_array();
|
||||
if($int_query['total']){
|
||||
$today_count += $int_query['total'];
|
||||
$month_count += $int_query['total'];
|
||||
}
|
||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key='.$this->key;
|
||||
$this->ci->load->library('mycurl');
|
||||
$data = [
|
||||
|
||||
Reference in New Issue
Block a user