支付宝接口
This commit is contained in:
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\model\Test;
|
||||
use app\api\model\User;
|
||||
use fastphp\base\Controller;
|
||||
use app\api\model\Logs;
|
||||
|
||||
class Index
|
||||
class Index extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$test = new Test();
|
||||
$list = $test->field('user,operation,record,create_time')->order('id')->limit('50')->fetchAll();
|
||||
$count = $test->field('count(1) as count')->fetch();
|
||||
$logs = new Logs();
|
||||
$list = $logs->getUserListPage('50');
|
||||
$count = $logs->getCount();
|
||||
$data = [
|
||||
'Code'=>10000,
|
||||
'count'=>$count['count'],
|
||||
@@ -27,8 +28,8 @@ class Index
|
||||
die;
|
||||
}
|
||||
$page = ($_GET['page'] - 1) * 50;
|
||||
$test = new Test();
|
||||
$list = $test->limit("$page,50")->fetchAll();
|
||||
$logs = new Logs();
|
||||
$list = $logs->getUserListPage("$page,50");
|
||||
$data = [
|
||||
'Code'=>10000,
|
||||
'data'=>$list
|
||||
|
||||
17
app/api/model/Logs.php
Normal file
17
app/api/model/Logs.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use fastphp\base\Model;
|
||||
|
||||
class Logs extends Model
|
||||
{
|
||||
protected $table = 'logs';
|
||||
|
||||
//按照页数获取日志数据
|
||||
public function getUserListPage($page)
|
||||
{
|
||||
return $this->field('user,operation,record,create_time')->order('create_time desc')->limit($page)->fetchAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use fastphp\base\Model;
|
||||
|
||||
class Test extends Model
|
||||
{
|
||||
protected $table = 'test';
|
||||
}
|
||||
65
app/logs/controller/Index.php
Normal file
65
app/logs/controller/Index.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\logs\controller;
|
||||
|
||||
use app\logs\model\Logs;
|
||||
use app\logs\model\User;
|
||||
use fastphp\base\Controller;
|
||||
|
||||
class Index extends Controller
|
||||
{
|
||||
public function export()
|
||||
{
|
||||
$data = json_decode(file_get_contents("php://input"),true);
|
||||
if(!$data){
|
||||
die;
|
||||
}
|
||||
die;
|
||||
// $logs = new Logs();
|
||||
// $logs->add($data);
|
||||
}
|
||||
|
||||
//点击客户管理
|
||||
public function clickVipInfo(){
|
||||
$data = json_decode(file_get_contents("php://input"),true);
|
||||
if(!$data){
|
||||
die;
|
||||
}
|
||||
$user = new User();
|
||||
$list = json_encode($user->getUserList());
|
||||
$data['info'] = $list;
|
||||
$data['create_time'] = date('Y-m-d H:i:s',time());
|
||||
$logs = new Logs();
|
||||
$status = $logs->add($data);
|
||||
if($status){
|
||||
echo json_encode(['Code'=>20000,]);
|
||||
}
|
||||
}
|
||||
|
||||
//点击客户信息产品账号//点击客户更多联系方式//点击客户信息会员价
|
||||
public function clickInfo(){
|
||||
$data = json_decode(file_get_contents("php://input"),true);
|
||||
if(!$data){
|
||||
die;
|
||||
}
|
||||
$user = new User();
|
||||
$info = $user->getOne(['id'=>$data['userid']]);
|
||||
$data['info'] = $info['LoginCode'];
|
||||
$data['create_time'] = date('Y-m-d H:i:s',time());
|
||||
unset($data['userid']);
|
||||
$logs = new Logs();
|
||||
$logs->add($data);
|
||||
echo json_encode(['Code'=>20000,]);
|
||||
}
|
||||
|
||||
public function hoveInfo(){
|
||||
$data = json_decode(file_get_contents("php://input"),true);
|
||||
if(!$data){
|
||||
die;
|
||||
}
|
||||
$data['create_time'] = date('Y-m-d H:i:s',time());
|
||||
$logs = new Logs();
|
||||
$logs->add($data);
|
||||
echo json_encode(['Code'=>20000,]);
|
||||
}
|
||||
}
|
||||
11
app/logs/model/Logs.php
Normal file
11
app/logs/model/Logs.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\logs\model;
|
||||
|
||||
use fastphp\base\Model;
|
||||
|
||||
class Logs extends Model
|
||||
{
|
||||
protected $table = 'logs';
|
||||
}
|
||||
19
app/logs/model/User.php
Normal file
19
app/logs/model/User.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\logs\model;
|
||||
|
||||
use fastphp\base\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'user';
|
||||
|
||||
public function getUserList(){
|
||||
return $this->field('LoginCode')->order('id desc')->limit('50')->fetchAll();
|
||||
}
|
||||
|
||||
public function getOne($where){
|
||||
return $this->field('LoginCode')->where($where)->fetch();
|
||||
}
|
||||
}
|
||||
71
app/order/controller/Admin.php
Normal file
71
app/order/controller/Admin.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\order\controller;
|
||||
|
||||
use app\order\model\CashOut as CashMoedl;
|
||||
use fastphp\base\Controller;
|
||||
use alipay\Alipay;
|
||||
|
||||
class Admin extends Controller
|
||||
{
|
||||
//获取记录
|
||||
public function getData()
|
||||
{
|
||||
$cash = new CashMoedl;
|
||||
$list = $cash->getListPage();
|
||||
//提现状态
|
||||
$status = ['待处理', '同意', '拒绝'];
|
||||
foreach ($list as &$v) {
|
||||
$v['status'] = $status[$v['status']];
|
||||
$v['alipay_account'] = substr($v['alipay_account'], 0, 3) . '***' . substr($v['alipay_account'], -3);
|
||||
}
|
||||
$count = $cash->getCount();
|
||||
$data = [
|
||||
'Code' => 10000,
|
||||
'count' => $count['count'],
|
||||
'data' => $list,
|
||||
];
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
//获取指定页码数据
|
||||
public function pageList()
|
||||
{
|
||||
if (!$_GET) {
|
||||
die;
|
||||
}
|
||||
$page = ($_GET['page'] - 1) * 50;
|
||||
$cash = new CashMoedl;
|
||||
$list = $cash->getListPage('*', 'id desc', "$page,50");
|
||||
$data = [
|
||||
'Code' => 10000,
|
||||
'data' => $list,
|
||||
];
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
//处理提现申请
|
||||
public function handle()
|
||||
{
|
||||
$data = json_decode(file_get_contents("php://input"),true)['info'];
|
||||
$id = $data['id'];
|
||||
unset($data['update_time']);
|
||||
unset($data['create_time']);
|
||||
unset($data['id']);
|
||||
|
||||
$user = $this->userinfo;
|
||||
$data['op_user'] = $user['LoginName'];
|
||||
$status = ['0', '1', '2'];
|
||||
if(!in_array($data['status'],$status)){
|
||||
unset($data['status']);
|
||||
}
|
||||
$cash = new CashMoedl;
|
||||
$up_status = $cash->where(['id'=>$id])->update($data);
|
||||
$return_info = [
|
||||
'Code' => 10000,
|
||||
];
|
||||
echo json_encode($return_info);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
29
app/order/controller/Index.php
Normal file
29
app/order/controller/Index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\order\controller;
|
||||
|
||||
use app\order\model\CashOut as CashMoedl;
|
||||
use fastphp\base\Controller;
|
||||
|
||||
class Index extends Controller
|
||||
{
|
||||
//接收提现请求
|
||||
public function index()
|
||||
{
|
||||
$post = json_decode(file_get_contents("php://input"), true);
|
||||
$data = [];
|
||||
$data['userid'] = $this->userinfo['UserId'];
|
||||
$data['username'] = $this->userinfo['LoginName'];
|
||||
$data['money'] = $post['cash_out_money'];
|
||||
$data['apply_reason'] = $post['reason'];
|
||||
$data['alipay_account'] = $post['alipay_account'];
|
||||
$cash = new CashMoedl;
|
||||
$status = $cash->add($data);
|
||||
if ($status) {
|
||||
echo json_encode(['Code'=>10000,]);
|
||||
} else {
|
||||
echo json_encode(['Code'=>-10000,]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
13
app/order/model/CashOut.php
Normal file
13
app/order/model/CashOut.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace app\order\model;
|
||||
|
||||
use fastphp\base\Model;
|
||||
|
||||
class CashOut extends Model
|
||||
{
|
||||
protected $table = 'cash_out';
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user