|
@@ -17,7 +17,7 @@ class AccountController extends Curd
|
|
|
|
|
|
public function my($id)
|
|
public function my($id)
|
|
{
|
|
{
|
|
- $account = MemberAccount::where('join_account_member_id', $id)->where('member_account_status','ACTIVED')->get()->toArray();
|
|
|
|
|
|
+ $account = MemberAccount::where('join_account_member_id', $id)->get()->toArray();
|
|
if (!$account) {
|
|
if (!$account) {
|
|
// 账户表
|
|
// 账户表
|
|
$accountData = [
|
|
$accountData = [
|
|
@@ -39,13 +39,13 @@ class AccountController extends Curd
|
|
|
|
|
|
$account = MemberAccount::where('join_account_member_id', $id)->get()->toArray();
|
|
$account = MemberAccount::where('join_account_member_id', $id)->get()->toArray();
|
|
}
|
|
}
|
|
- if ($account[0]['member_account_classify'] == 'POINTS'){
|
|
|
|
|
|
+ if ($account[0]['member_account_classify'] == 'POINTS') {
|
|
$account = array_reverse($account);
|
|
$account = array_reverse($account);
|
|
}
|
|
}
|
|
|
|
|
|
- foreach ($account as &$item){
|
|
|
|
- $item['member_account_duedate'] = !empty($item['member_account_duedate']) ? date('Y-m-d H:i:s',$item['member_account_duedate']) : '长期有效';
|
|
|
|
- $item['member_account_surplus'] = round($item['member_account_surplus'] + $item['member_account_added'],2);
|
|
|
|
|
|
+ foreach ($account as &$item) {
|
|
|
|
+ $item['member_account_duedate'] = !empty($item['member_account_duedate']) ? date('Y-m-d H:i:s', $item['member_account_duedate']) : '长期有效';
|
|
|
|
+ $item['member_account_surplus'] = round($item['member_account_surplus'] + $item['member_account_added'], 2);
|
|
}
|
|
}
|
|
|
|
|
|
return json_success('', $account);
|
|
return json_success('', $account);
|
|
@@ -81,30 +81,58 @@ class AccountController extends Curd
|
|
/**
|
|
/**
|
|
* 用户的账户
|
|
* 用户的账户
|
|
*/
|
|
*/
|
|
- public function selectMemberAccount(Request $request)
|
|
|
|
|
|
+ public function selectMemberAccount(Request $request)
|
|
{
|
|
{
|
|
- $memberId = $request->get('member_id','');
|
|
|
|
- if (!$memberId){
|
|
|
|
|
|
+ $memberId = $request->get('member_id', '');
|
|
|
|
+ if (!$memberId) {
|
|
return json_fail('参数异常');
|
|
return json_fail('参数异常');
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$account = MemberAccount::where('join_account_member_id', $memberId)->get()->toArray();
|
|
$account = MemberAccount::where('join_account_member_id', $memberId)->get()->toArray();
|
|
|
|
|
|
$data = [];
|
|
$data = [];
|
|
- foreach ($account as $item){
|
|
|
|
- $item['member_account_duedate'] = !empty($item['member_account_duedate']) ? date('Y-m-d H:i:s',$item['member_account_duedate']) : '长期有效';
|
|
|
|
|
|
+ foreach ($account as $item) {
|
|
|
|
+ $item['member_account_duedate'] = !empty($item['member_account_duedate']) ? date('Y-m-d H:i:s', $item['member_account_duedate']) : '长期有效';
|
|
|
|
|
|
- if ($item['member_account_classify'] == 'POINTS'){
|
|
|
|
|
|
+ if ($item['member_account_classify'] == 'POINTS') {
|
|
$data['points'] = $item;
|
|
$data['points'] = $item;
|
|
- }elseif ($item['member_account_classify'] == 'CASH'){
|
|
|
|
|
|
+ } elseif ($item['member_account_classify'] == 'CASH') {
|
|
$data['cash'] = $item;
|
|
$data['cash'] = $item;
|
|
- }elseif ($item['member_account_classify'] == 'CARD'){
|
|
|
|
|
|
+ } elseif ($item['member_account_classify'] == 'CARD') {
|
|
$data['card'][] = $item;
|
|
$data['card'][] = $item;
|
|
- }elseif ($item['member_account_classify'] == 'WELFARE'){
|
|
|
|
|
|
+ } elseif ($item['member_account_classify'] == 'WELFARE') {
|
|
$data['welfare'] = $item;
|
|
$data['welfare'] = $item;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return json_success('', $data);
|
|
return json_success('', $data);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @Desc 修改账户状态
|
|
|
|
+ * @Author Gorden
|
|
|
|
+ * @Date 2024/9/12 16:28
|
|
|
|
+ *
|
|
|
|
+ * @param Request $request
|
|
|
|
+ * @return \support\Response
|
|
|
|
+ */
|
|
|
|
+ public function updateStatus(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $accountId = $request->post('account_id');
|
|
|
|
+ $status = $request->post('status');
|
|
|
|
+ if (!$accountId || !$status || !in_array($status,['DISABLED','ACTIVED','EXPIRED'])){
|
|
|
|
+ return json_fail('参数异常');
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ $account = MemberAccount::where('member_account_id',$accountId)->first();
|
|
|
|
+ $account->member_account_status = $status;
|
|
|
|
+ $account->save();
|
|
|
|
+
|
|
|
|
+ _syslog("修改账户状态",'修改账户状态成功');
|
|
|
|
+ return json_success('账户状态修改成功');
|
|
|
|
+ }catch (\Exception $e){
|
|
|
|
+ _syslog("修改账户状态",'账户状态修改失败');
|
|
|
|
+ return json_fail('账户状态修改失败');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|