|
|
|
@ -41,16 +41,36 @@ class WxPaymentController extends BaseController
|
|
|
|
|
$params = I('get.');
|
|
|
|
|
$page = $params['p'] ? intval($params['p']) : 1;
|
|
|
|
|
$row = $params['row'] ? intval($params['row']) : 10;
|
|
|
|
|
$where = [];
|
|
|
|
|
$where = [
|
|
|
|
|
'_string'=>'1=1'
|
|
|
|
|
];
|
|
|
|
|
if(isset($_REQUEST['nickname'])){
|
|
|
|
|
$where['nickname'] = ["LIKE","%{$_REQUEST['nickname']}%"];
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['realname'])){
|
|
|
|
|
$where['realname'] = ["LIKE","%{$_REQUEST['realname']}%"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['type'])){
|
|
|
|
|
if($_REQUEST['type'] == 1){
|
|
|
|
|
$where['_string'] .= " AND realname = ''";
|
|
|
|
|
}
|
|
|
|
|
if($_REQUEST['type'] == 2){
|
|
|
|
|
$where['_string'] .= " AND realname != ''";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = M('mini_program_user', 'tab_')
|
|
|
|
|
->field("wx_json",true)
|
|
|
|
|
->where($where)
|
|
|
|
|
->page($page,$row)
|
|
|
|
|
->select();
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
if(empty($value['realname'])){
|
|
|
|
|
$data[$key]['is_pay'] =0;
|
|
|
|
|
}else{
|
|
|
|
|
$data[$key]['is_pay'] =1;
|
|
|
|
|
}
|
|
|
|
|
$data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
|
|
|
|
|
}
|
|
|
|
|
$count = M('mini_program_user', 'tab_')->where($where)->count();
|
|
|
|
@ -61,6 +81,26 @@ class WxPaymentController extends BaseController
|
|
|
|
|
$this->assign('data', $data);
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
public function updateRealname()
|
|
|
|
|
{
|
|
|
|
|
$params = I('post.');
|
|
|
|
|
M('mini_program_user', 'tab_')->save([
|
|
|
|
|
'id'=>$params['id'],
|
|
|
|
|
'realname'=>trim($params['realname'])
|
|
|
|
|
]);
|
|
|
|
|
$this->ajaxReturn([
|
|
|
|
|
'success'=>'ok'
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
public function addPayList()
|
|
|
|
|
{
|
|
|
|
|
$params = I('post.');
|
|
|
|
|
$batch = date('Ymd').date('His').sp_random_num(3);
|
|
|
|
|
$item = M('mini_program_user',"tab_")->field('realname,openid')->where(['id'=>$params['id']])->find();
|
|
|
|
|
$item['statement_money'] = $params['statement_money'];
|
|
|
|
|
$this->addListItem($batch,$item);
|
|
|
|
|
$this->ajaxReturn(["status"=>1,"msg"=>"添加成功"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function customerExport()
|
|
|
|
|
{
|
|
|
|
@ -90,7 +130,7 @@ class WxPaymentController extends BaseController
|
|
|
|
|
$line = 2;
|
|
|
|
|
//设置模板文件
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $line-1)->setCellValue('B'.$line, $value['openid']);
|
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $line-1)->setCellValue('B'.$line, $value['openid'])->setCellValue('C'.$line, $value['realname']);
|
|
|
|
|
$line++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -199,36 +239,41 @@ class WxPaymentController extends BaseController
|
|
|
|
|
if(count($checkarr) < 1){
|
|
|
|
|
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
|
|
|
|
|
}
|
|
|
|
|
foreach ($checkarr as $k => &$v) {
|
|
|
|
|
$this->addListItem($batch,$v);
|
|
|
|
|
}
|
|
|
|
|
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function addListItem($batch,$v)
|
|
|
|
|
{
|
|
|
|
|
$pinyin = new \Think\Pinyin();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$wxPayment = M('wx_payment',"tab_");
|
|
|
|
|
foreach ($checkarr as $k => &$v) {
|
|
|
|
|
if(!isset($v['realname']) || !isset($v['openid']) || !isset($v['statement_money']) || $v['realname'] == '' || $v['openid'] == '' || $v['statement_money'] <= 0){
|
|
|
|
|
$wxPayment->where("batch_num = '{$v['batch_num']}'")->delete();
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"真实姓名,openid,打款金额均不允许为空"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!isset($v['realname']) || !isset($v['openid']) || !isset($v['statement_money']) || $v['realname'] == '' || $v['openid'] == '' || $v['statement_money'] <= 0){
|
|
|
|
|
$wxPayment->where("batch_num = '{$batch}'")->delete();
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"真实姓名,openid,打款金额均不允许为空"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$num = mb_strlen($v['realname'], 'UTF8');
|
|
|
|
|
$short = '';
|
|
|
|
|
for ($i = 0; $i < $num; $i++) {
|
|
|
|
|
$str = mb_substr($v['realname'], $i, $i + 1, 'UTF8');
|
|
|
|
|
$short .= $pinyin->getFirstChar($str);
|
|
|
|
|
}
|
|
|
|
|
$num = mb_strlen($v['realname'], 'UTF8');
|
|
|
|
|
$short = '';
|
|
|
|
|
for ($i = 0; $i < $num; $i++) {
|
|
|
|
|
$str = mb_substr($v['realname'], $i, $i + 1, 'UTF8');
|
|
|
|
|
$short .= $pinyin->getFirstChar($str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$v['batch_num'] = $batch;
|
|
|
|
|
$v['statement_num'] = "WX{$short}".date('Ymd').date('His').sp_random_string(5);
|
|
|
|
|
|
|
|
|
|
$v['create_time'] = time();
|
|
|
|
|
$res = $wxPayment->add($v);
|
|
|
|
|
if($res === false){
|
|
|
|
|
$wxPayment->where("batch_num = '{$v['batch_num']}'")->delete();
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
|
|
|
|
|
}
|
|
|
|
|
$v['batch_num'] = $batch;
|
|
|
|
|
$v['statement_num'] = "WX{$short}".date('Ymd').date('His').sp_random_string(5);
|
|
|
|
|
|
|
|
|
|
$v['create_time'] = time();
|
|
|
|
|
$res = $wxPayment->add($v);
|
|
|
|
|
if($res === false){
|
|
|
|
|
$wxPayment->where("batch_num = '{$batch}'")->delete();
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
|
|
|
|
|
}
|
|
|
|
|
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function showPayment()
|
|
|
|
|
{
|
|
|
|
|
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
|
|
|
|
|