<?php

namespace app\controller\api;

use support\Request;

use App\Utils\ApiResponseApp;


use App\model\Dictionary;
use App\model\ExchangeRate;
use hg\apidoc\annotation as Apidoc;
use support\Db;

/**
 * @Apidoc\Title("公共控制器?")
 */

class CommonController
{
    protected $noNeedLogin = ['config', 'get_project', 'get_projectdetailed', 'get_mechanism_list'];


    /**
     * @Apidoc\Title("1.0 获取全局配置")
     * @Apidoc\Url("api/common/config")
     * @Apidoc\Method("POST")
     */
    public function config(Request $request)
    {

        $Dictionary=Dictionary::all();
        $res=[];
        $ExchangeRate = ExchangeRate::all();
        $res = [
            "account_notice" => "Log in to link account and get 300 to 3,000 random points a day",
            // "vi_rate" => "2.49",
            // "trx_rate" => "0.00",
            // "nrly_rate" => "30",
            // "trx_rate1" => "",
            // "inr_rate" => "1.62",
            // "php_rate" => null,
            // "brl_rate" => "0.10",
            "brl_fee" => "300",
            "pkr_fee" => "300",
            // "pkr_rate" => "5",
            "pkr_min" => "2000",
            "brl_min" => "5000"
        ];
        foreach ($ExchangeRate as $item) {
            $res[strtolower($item['type']) . '_rate'] = $item['points'];
        }
        $col=['service_1','service_2','service_3','service_url','service_user_url','points'];
        foreach($Dictionary as $key=>$value){
            $res[$value->key]=$value->value;
        }
        return ApiResponseApp::success($res);
    }
        /**
     * @Apidoc\Title("1.0 消息根据type 判断类型")
     * @Apidoc\Url("api/common/messageList")
     * 3是首页弹窗   1是消息中心
     * {
    "data": [
        {
            "id": 2,
            "title": "Announcement",
            "content": "<p><img src=\"https://112233job.com/uploads/20250120/039faa1fb225ef5814a325218f2e00ee.jpg\" data-filename=\"filename\" style=\"width: 277.516px; height: 275.69px;\"><br></p>",
            "status": 1,
            "createtime": 1737370611,
            "updatetime": 0,
            "status_text": "Status 1"
        }
    ],
    "total": 0
}
     * @Apidoc\Method("POST")
     */
    public function messageList(Request $request){
        $type=$request->get('type');
        /**
         * 返回轮播图
         */
        if($type==5){

        }
    }

}