<?php

namespace app\api\controller;

use app\admin\lists\express\ExpressLists;
use app\admin\logic\operation\OpurchaseclassLogic;
use app\admin\validate\tools\GenerateTableValidate;
use app\admin\logic\tools\GeneratorLogic;
use app\common\model\goods\Goods;
use app\common\model\goods\Goodsclass;
use app\common\model\retail\Cashierclass;
use app\common\service\pay\PayService;
use app\common\service\PushService;
use app\common\service\wechat\WeChatMnpService;
use app\common\service\wechat\WeChatOaService;
use DateTime;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use stdClass;
use think\facade\Db;
use Webman\Config;
use Webman\RedisQueue\Redis;
use Yansongda\Pay\Pay;
use Webman\Push\Api;
use JPush\Client as JPush;
use support\Log;
use support\Redis as SupportRedis;

class IndexController extends BaseApiController
{
    public $notNeedLogin = ['index','app_update','express_list'];

    public function index()
    {
        d(uniqid(1 . '_', true));
           return json(['msg' =>create_password(123456, '11d3')]);
    }

    /**
     * @notes 下载文件
     */
    public function download()
    {
        $params = (new GenerateTableValidate())->goCheck('download');
        $result = GeneratorLogic::download($params['file']);
        if (false === $result) {
            return $this->fail(GeneratorLogic::getError() ?: '下载失败');
        }
        return response()->download($result, 'webman-curd.zip');
    }

    /**
     * @notes 获取app更新信息
     */
    public function app_update(){
       $find= Db::name('app_update')->where('type',2)->order('id','desc')->findOrEmpty();
       return $this->success('ok',$find);
    }

}