61 lines
2.5 KiB
PHP
61 lines
2.5 KiB
PHP
<?php
|
|
namespace Home\Controller;
|
|
use Think\Controller;
|
|
class PublicController extends Controller {
|
|
|
|
public function login(){
|
|
$user_name = I('user_name');
|
|
$user_password = I('user_password');
|
|
$user_info = D('user')->where(array('user_name'=>$user_name, 'user_password'=>md6($user_password)))->find();
|
|
if($user_info){
|
|
$role_info = D('role_user')->where(array('user_id'=>$user_info['user_id']))->find();
|
|
$res['role_id'] = $role_info['role_id'];
|
|
$res['user_id'] = $user_info['user_id'];
|
|
$res['can_check'] = $user_info['can_check'];
|
|
$this->success($res);
|
|
}
|
|
else{
|
|
$this->error('用户名或密码错误');
|
|
// $this->error($user_password);
|
|
}
|
|
|
|
}
|
|
|
|
public function notify()
|
|
{
|
|
$fileContent = file_get_contents("php://input");
|
|
|
|
$notify_post = json_decode(json_encode(simplexml_load_string($fileContent, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
|
D('notify')->add(array('res'=>json_encode($notify_post)));
|
|
// if ($notify_post["result_code"] == "SUCCESS") {
|
|
// $transaction_id = $notify_post['transaction_id'];
|
|
// $order_num = $notify_post['attach'];
|
|
// $real_pay = $notify_post["cash_fee"] * 0.01;
|
|
// $order_data = D('order')->where(array('order_num'=>$order_num))->find();
|
|
// if($order_data['status_code'] == 101 || $order_data['status_code'] == 301){
|
|
// $save = array();
|
|
// $save['transaction_id'] = $transaction_id;
|
|
// $save['real_pay'] = $real_pay;
|
|
// $save['paytime'] = time();
|
|
// $save['status_code'] = 110;
|
|
// if($order_data['status_code'] == 301){
|
|
// $save['status_code'] = 310;
|
|
// }
|
|
// $order_data = D('order')->where(array('order_num'=>$order_num))->save($save);
|
|
// $log_data = array();
|
|
// $log_data['order_id'] = $order_data['order_id'];
|
|
// $log_data['time'] = time();
|
|
// $log_data['status_code'] = $save['status_code'];
|
|
// $log_data['status_name'] = '检测中';
|
|
// $log_data['desc'] = '已付款(待邮寄切片)';
|
|
// $log_data['is_qiantai'] = 1;
|
|
// $log_data['user_id'] = $this->user_id;
|
|
// D('order_log')->add($log_data);
|
|
//
|
|
// }
|
|
//
|
|
// }
|
|
echo "success";
|
|
}
|
|
|
|
} |