| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?phpnamespace app\common\util;use Hprose\Http\Client;class YcApiHprose{    protected $client;    protected $wechatCode ="rmkj_mp";    protected $wechatSignKey = "123456";    public function __construct()    {        $this->wechatCode= env("app.wechat_code");        $this->wechatSignKey= env("app.wechat_sign_key");        $url = env("app.hprose_api");// "http://api.ycxxkj.com/index.php/api/WechatHprose/server";        $this->client = Client::create($url, false);    }    protected function getAuthParam()    {        $auth = [];        $auth["time"] = time();        $auth["code"] = $this->wechatCode;        $auth["sign"] = strtoupper(md5($auth["code"] . $auth["time"] . $this->wechatSignKey));        return $auth;    }    /**     * 发送模板消息     */    public function templateMessageSend($data)    {        $res = $this->client->templateMessageSend($this->getAuthParam(), $data);        return $res;    }}
 |