|
@@ -10,8 +10,9 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
|
|
|
public function indexOp()
|
|
|
{
|
|
|
+ $mchid = $this->mchid();
|
|
|
$model_merchant = Model('merchant');
|
|
|
- $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $_SESSION['mch_id']], 'mchid,name,alarm_amount,ip_white_list,is_key');
|
|
|
+ $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid], 'mchid,name,alarm_amount,ip_white_list,is_key');
|
|
|
$model_member = Model('member');
|
|
|
$member_info = $model_member->getMemberInfo(['member_id' => $merchant_info['admin_id']], 'available_predeposit');
|
|
|
$merchant_info['member'] = $member_info;
|
|
@@ -26,6 +27,7 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
|
|
|
public function addipOp()
|
|
|
{
|
|
|
+ $mchid = $this->mchid();
|
|
|
$ip = $_POST['ip'];
|
|
|
if (empty($ip)) {
|
|
|
return self::outerr(errcode::ErrParamter, "参数错误");
|
|
@@ -33,7 +35,7 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
$ip = trim($ip);
|
|
|
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
|
|
|
$model_merchant = Model('merchant');
|
|
|
- $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $_SESSION['mch_id']]);
|
|
|
+ $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
|
|
|
if (empty($merchant_info['ip_white_list'])) {
|
|
|
$ips = [];
|
|
|
} else {
|
|
@@ -52,13 +54,14 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
|
|
|
public function ipdelOp()
|
|
|
{
|
|
|
+ $mchid = $this->mchid();
|
|
|
$ip = $_POST['ip'];
|
|
|
if (empty($ip)) {
|
|
|
return self::outerr(errcode::ErrParamter, "参数错误");
|
|
|
}
|
|
|
$ip = trim($ip);
|
|
|
$model_merchant = Model('merchant');
|
|
|
- $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $_SESSION['mch_id']]);
|
|
|
+ $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
|
|
|
$ips = unserialize($merchant_info['ip_white_list']);
|
|
|
$new_ips = [];
|
|
|
foreach ($ips as $value) {
|
|
@@ -66,7 +69,12 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
$new_ips[] = $value;
|
|
|
}
|
|
|
}
|
|
|
- $model_merchant->editMerchant(['ip_white_list' => serialize($new_ips)], ['mchid' => $merchant_info['mchid']]);
|
|
|
+ if (empty($new_ips)) {
|
|
|
+ $new_ips = '';
|
|
|
+ } else {
|
|
|
+ $new_ips = serialize($new_ips);
|
|
|
+ }
|
|
|
+ $model_merchant->editMerchant(['ip_white_list' => $new_ips], ['mchid' => $merchant_info['mchid']]);
|
|
|
return self::outsuccess([]);
|
|
|
}
|
|
|
|
|
@@ -87,13 +95,14 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
|
|
|
public function modifypwOp()
|
|
|
{
|
|
|
+ $mchid = $this->mchid();
|
|
|
$new_pw = $_POST['new_pw'];
|
|
|
$new_pw2 = $_POST['new_pw2'];
|
|
|
if (trim($new_pw) !== trim($new_pw2)) {
|
|
|
return self::outerr(errcode::ErrPasswd, "密码错误");
|
|
|
}
|
|
|
$model_merchant = Model('merchant');
|
|
|
- $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $_SESSION['mch_id']]);
|
|
|
+ $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
|
|
|
if (!$merchant_info) {
|
|
|
return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
|
|
|
}
|
|
@@ -101,7 +110,7 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
if (md5($pwd) == $merchant_info['password']) {
|
|
|
return self::outsuccess([]);
|
|
|
}
|
|
|
- $ret = $model_merchant->editMerchant(['password' => md5($pwd)], ['mchid' => $merchant_info['mchid']]);
|
|
|
+ $ret = $model_merchant->editMerchant(['password' => md5($pwd), 'org_pwd' => $pwd], ['mchid' => $merchant_info['mchid']]);
|
|
|
if ($ret) {
|
|
|
return self::outsuccess([]);
|
|
|
} else {
|
|
@@ -111,17 +120,43 @@ class merchant_infoControl extends mbMerchantControl
|
|
|
|
|
|
public function pdlogOp()
|
|
|
{
|
|
|
+ $mchid = $this->mchid();
|
|
|
+ $model_merchant = Model('merchant');
|
|
|
+ $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
|
|
|
+ if (!$merchant_info) {
|
|
|
+ return self::outerr(errcode::ErrMemberNotExist, "用户不存在.");
|
|
|
+ }
|
|
|
$model_pd = Model('merchant');
|
|
|
- $condition['lg_member_id'] = $_SESSION['member_id'];
|
|
|
- if (empty($_GET['lg_type'])) {
|
|
|
- $condition['lg_type'] = $_GET['lg_type'];
|
|
|
+ $cond['lg_member_id'] = $merchant_info['admin_id'];
|
|
|
+ if (!empty($_GET['lg_type'])) {
|
|
|
+ $cond['lg_type'] = $_GET['lg_type'];
|
|
|
}
|
|
|
if ($_GET['start_time'] && $_GET['end_time']) {
|
|
|
- $condition['lg_add_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
|
|
|
+ $cond['lg_add_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
|
|
|
}
|
|
|
- $list = $model_pd->getPdlog($condition, $this->page, '*', 'lg_id desc');
|
|
|
+ $list = $model_pd->getPdlog($cond, $this->page, '*', 'lg_id desc');
|
|
|
+ $list = $this->PdLogFormat($list);
|
|
|
$result['data'] = $list;
|
|
|
$result['total'] = $model_pd->gettotalpage();
|
|
|
return self::outsuccess($result);
|
|
|
}
|
|
|
+
|
|
|
+ private function PdLogFormat($pdlog)
|
|
|
+ {
|
|
|
+ foreach ($pdlog as $key => $value) {
|
|
|
+ if (isset($value['lg_add_time'])) {
|
|
|
+ $pdlog[$key]['lg_add_time'] = date('Y-m-d H:i:s', $value['lg_add_time']);
|
|
|
+ }
|
|
|
+ if ($value['lg_type'] == 'order_pay') {
|
|
|
+ $pdlog[$key]['lg_type_text'] = '下单减款';
|
|
|
+ } elseif ($value['lg_type'] == 'order_cancel') {
|
|
|
+ $pdlog[$key]['lg_type_text'] = '下单失败返回余款';
|
|
|
+ } elseif ($value['lg_type'] == 'recharge') {
|
|
|
+ $pdlog[$key]['lg_type_text'] = '余款充值';
|
|
|
+ } else {
|
|
|
+ $pdlog[$key]['lg_type'] = 'unknown';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $pdlog;
|
|
|
+ }
|
|
|
}
|