前端發送

admin/login.php

處理請求

var/Widget/Login.php

替註冊頁面添加 reCAPTCHA 驗證

admin/register.php

在 Register 類 添加 send_post 功能

    private function send_post($url, $post_data){
    $postdata = http_build_query($post_data);
    $options = a`請輸入代碼`rray(
        'http' => array(
            'method' => 'POST',
            'header' => 'Content-type:application/x-www-form-urlencoded',
            'content' => $postdata,
            'timeout' => 10 // 超时时间(单位:s)
        )
    );
    $context = stream_context_create($options);
    $recaptcha_json_result = file_get_contents($url, false, $context);  
    $result = json_decode($recaptcha_json_result, true);
    return $result;
}

在 action 添加解析參數以及判斷異常功能

        /** 截获验证异常 */
    if ($error = $validator->run($this->request->from('name', 'password', 'mail', 'confirm', 'g-recaptcha-response'))) {
 
        Cookie::set('__typecho_remember_name', $this->request->name);
        Cookie::set('__typecho_remember_mail', $this->request->mail);

        /** 设置提示信息 */
        Notice::alloc()->set($error);
        $this->response->goBack();
    }
    
    /** Google reCaptcha v2 */
    $post_data = [        
        'secret' => 'secret_key_here',
        'response' => $_POST["g-recaptcha-response"]
    ]; 
    $recaptcha_result = $this->send_post('https://www.google.com/recaptcha/api/siteverify', $post_data);

返回前端文件

admin/register.php

在 form 中添加 驗證欄位, 方便 recaptcha 傳入

            <p>
            <div class="g-recaptcha" data-sitekey="site_key_here"></div>
        </p>

在底部 script 後面加上

引用來源

https://newabug.top/archives/67.html

從前一直很好奇, 每日市場搓合這麼多次, 到底一次成交多少口才是 "超過大部分數量",
分析某日夜盤訂單後, 結果令人意外的, 只要能一次成交三口 便超過百分之九十搓合的紀錄,

但這只是針對單筆紀錄做分析, 並不代表下單的人一次只下三口,
推測比較貼近實際情況的情形是, 輸入5口, 分成 1,1,3 這樣成交

2024-03-28T17:50:55.png

一直好奇指數是如何計算的, 稍微思考了一下後有了大致思路

流通發行股數再乘上當前成交價格, 即可計算出該公司當前大約市值
將所有公司市值相加, 便能大致了解該市場總市值
再透過 所占比重*變化量 便能計算實際點數差異

423599890_946949957004055_2522423213989080569_n.png

螢幕擷取畫面 2024-03-29 013635.png