You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
4.1 KiB
100 lines
4.1 KiB
<?php
|
|
defined('IN_IA') or exit('Access Denied');
|
|
|
|
class storeCertified_WeliamController{
|
|
|
|
public function index()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$where = [];
|
|
$pindex = max(1, intval($_GPC['page']));
|
|
$psize = 10;
|
|
|
|
if (!empty($_GPC['keyword'])) {
|
|
if ($_GPC['keywordtype'] == 1) {
|
|
$where['storeid'] = trim($_GPC['keyword']);
|
|
} else if ($_GPC['keywordtype'] == 2) {
|
|
$storeIdArr = [];
|
|
$storeAll = pdo_getall(PDO_NAME . 'merchantdata',['storename like' => '%'.trim($_GPC['keyword']).'%'],'id');
|
|
foreach ($storeAll as $storeRow) $storeIdArr[] = $storeRow['id'];
|
|
$where['storeid#'] = $storeIdArr ? implode(",",$storeIdArr) : '0';
|
|
} else if ($_GPC['keywordtype'] == 3) {
|
|
$where['@name@'] = trim($_GPC['keyword']);
|
|
} else if ($_GPC['keywordtype'] == 4) {
|
|
$where['mobile'] = trim($_GPC['keyword']);
|
|
}
|
|
}
|
|
|
|
if (is_numeric($_GPC['status'])) $where['status'] = trim($_GPC['status']);
|
|
|
|
$memberData = Util::getNumData("*", PDO_NAME . 'merchant_certified', $where, 'id desc', $pindex, $psize, 1);
|
|
$list = $memberData[0];
|
|
$pager = $memberData[1];
|
|
foreach ($list as &$item) {
|
|
$storeData = pdo_get(PDO_NAME . 'merchantdata',['id' => $item['storeid']],['storename','logo']);
|
|
$item['storename'] = $storeData['storename'];
|
|
$item['logo'] = tomedia($storeData['logo']);
|
|
$item['create_time'] = date("Y-m-d H:i:s",$item['create_time']);
|
|
}
|
|
|
|
include wl_template('store/certified/index');
|
|
}
|
|
|
|
/*
|
|
* 认证审核
|
|
*/
|
|
public function check() {
|
|
global $_W, $_GPC;
|
|
|
|
if ($_W['ispost']) {
|
|
|
|
try {
|
|
|
|
$id = $_GPC['data']['id'];
|
|
$check_result = $_GPC['data']['result'];
|
|
$reason = $_GPC['data']['reason']?:'';
|
|
if (empty($id) || !is_numeric($id)) show_json('缺少id参数');
|
|
if (!in_array($check_result,['reject','pass'])) show_json(0,'参数错误');
|
|
if ($check_result == 'reject' && empty($reason)) show_json(0,'请填写不通过的原因');
|
|
|
|
$query_res = pdo_get(PDO_NAME . 'merchant_certified',['id' => $id, 'status' => 0]);
|
|
if (!$query_res) show_json(0,'已审核,请勿重复审核');
|
|
|
|
$status = $check_result == 'pass' ? 1 : 2;
|
|
$update_arr = [
|
|
'status' => $status,
|
|
'remark' => $reason,
|
|
'check_userid' => $_W['uid'],
|
|
'check_time' => time()
|
|
];
|
|
|
|
pdo_begin(); // 开始事务
|
|
$up_res = pdo_update(PDO_NAME . 'merchant_certified',$update_arr,['id' => $id]);
|
|
|
|
if (!$up_res) throw new Exception('失败');
|
|
|
|
// 通过修改为商家身份
|
|
if ($status == 1) {
|
|
$up_res2 = pdo_update(PDO_NAME . 'merchantdata',['merchant_type' => 2],['id' => $query_res['storeid']]);
|
|
if (!$up_res2) throw new Exception('失败');
|
|
Member::updateStoreUserIdentity($query_res['storeid'],2);
|
|
} else {
|
|
$mid = pdo_getcolumn(PDO_NAME . 'merchantuser',['storeid' => $query_res['storeid'],'ismain' => [1,3]],'mid');
|
|
$content = '驳回原因:' . truncate_chinese_string($reason) . '...';
|
|
$link = h5_url('pagesA/businessCooperation/index',['sid' => $query_res['storeid']]);
|
|
News::jobNotice($mid, '您好,您的商户认证审核已完成', '商户认证审核通知', $content, '未通过', '点击重新申请', time(), $link);
|
|
}
|
|
|
|
pdo_commit(); // 提交事务
|
|
|
|
show_json(1,['message' => '成功', 'span' => $check_result == 'pass' ? '认证成功' : '认证失败']);
|
|
} catch (Exception $e) {
|
|
pdo_rollback(); // 回滚
|
|
show_json(0,$e->getMessage());
|
|
}
|
|
|
|
}
|
|
show_json(0,'请求失败');
|
|
}
|
|
}
|
|
|