MobileChain.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. * DSO2O多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  9. * 网站地址: http://www.csdeshang.com
  10. * ----------------------------------------------------------------------------
  11. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  12. * 不允许对程序代码以任何形式任何目的的再发布。
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class MobileChain extends MobileHome {
  17. protected $chain_info;
  18. public function initialize() {
  19. parent::initialize();
  20. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/chain.lang.php');
  21. $key = request()->header('X-DS-KEY');
  22. if ($key) {
  23. $mbchaintoken_model = model('mbchaintoken');
  24. $chain_token = $mbchaintoken_model->getMbchaintokenInfo(array('chain_token' => $key));
  25. if (!$chain_token) {
  26. ds_json_encode(40001, lang('chain_token_expire'));
  27. }
  28. $chain_model = model('chain');
  29. $chain_info = $chain_model->getChainInfo(array('chain_id' => $chain_token['chain_id']));
  30. if(!$chain_info){
  31. ds_json_encode(40001, lang('chain_not_exist'));
  32. }
  33. if(request()->action()!='apply_again' && request()->action()!='information'){
  34. if($chain_info['chain_state']!=1){
  35. ds_json_encode(40001, lang('chain_not_open'));
  36. }
  37. }
  38. $this->chain_info= $chain_info;
  39. } else {
  40. ds_json_encode(10001, 'Hacking Attempt');
  41. }
  42. }
  43. }
  44. ?>