MemberPayment.php 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. *
  7. * 用户支付配置表 Table<ai_member_payment>
  8. */
  9. namespace app\common\model;
  10. use think\Model;
  11. use think\facade\Env;
  12. class MemberPayment extends Model{
  13. protected $pk = 'id';
  14. /**
  15. * 获取配置参数
  16. * @param array 数据
  17. * @return bool
  18. */
  19. public static function config(int $miniapp_id,string $apiname){
  20. $rel = self::field('config')->where(['member_miniapp_id' => $miniapp_id,'apiname' => $apiname])->find();
  21. if(empty($rel)){
  22. return false;
  23. }
  24. $config = json_decode($rel['config'],true);
  25. $config['cert_path'] = empty($config['cert_path'])? '': Env::get('runtime_path').'cert'.DS.$miniapp_id.DS.$config['cert_path'];
  26. $config['key_path'] = empty($config['key_path'])? '': Env::get('runtime_path').'cert'.DS.$miniapp_id.DS.$config['key_path'];
  27. return $config;
  28. }
  29. }