HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.snodshop.com/Home/Lib/Action/EapiAction.class.php
<?php
header('content-type:application/json ;charset=utf-8;');
class EapiAction extends Action {
	//订单状态
	//order_status 0 待审核 1处理中 2确认 3发货 4签收 5拒收 6关闭 7完结 8申请退款 9已退款
	//支付方式
	//pay_type payOnDelivery货到付款 711711超市取货 quanjia全家 codepay码支付 alipay支付宝 wxpay微信支付 qrcode扫码支付 bankpay银行汇款
	//快递信息
	//delivery_name jetJ&T Express tcat黑貓宅急便 hct新竹 kerrytj嘉里大榮 shunfeng顺丰 jd京东快递 emsEMS jneJNE Express 

	public function _initialize(){

	}

	//获取全部订单信息
    public function getOrders() {
    	//分页
    	$pn = !empty(I('pn'))?intval(I('pn')):1;
    	$page = 50;
    	$map = [];
    	if(!empty(I('post.start_time')) && !empty(I('post.start_time'))){
    		$map['add_time'] = [['gt',strtotime(I('post.start_time'))],['elt',strtotime(I('post.end_time'))]];
    	}
    	$model = M('order');
    	$counts = $model->where($map)->count();
    	$orders = $model->where($map)->limit((($pn-1) * $page), $page)->order('add_time desc')->select();
    	// foreach ($orders as $k => $order) {
    	// 	//$this->getUserName($order['user_id']);
    	// }
    	$ret = [];
    	$ret['code'] = 0;
    	$ret['msg'] = '获取成功';
    	if(empty($orders)){
    		$ret['code'] = -1;
    		$ret['msg'] = '暂无数据';
    	}
    	foreach ($orders as $k => $v) {
    		$orders[$k]['username'] = $this->getUserName($v['user_id']);
    	}
    	$ret['data'] = $orders;
    	$ret['pn'] = $pn;
    	$ret['page'] = ceil($counts/50);
    	$ret['total'] = $counts;
    	echo json_encode($ret);exit;
    }

    //获取订单
    public function getOrder(){
    	$model = M('order');
    	$map = [];
    	if(!empty(I('order_no'))) $map['order_no'] = I('order_no');
    	$orders = $model->where($map)->find();
    	$ret = [];
    	$ret['code'] = 0;
    	$ret['msg'] = '获取成功';
    	$orders['username'] = $this->getUserName($orders['user_id']);
    	$ret['data'] = $orders;
    	echo json_encode($ret);exit;
    }
    /**
     * 返回用户名
     * $user_id
     */
    private function getUserName($user_id){
    	$model = M('user');
    	$map = [];
    	$map['id'] = $user_id;
    	$user = $model->where($map)->getField('username');
    	return $user;
    }
}