Master.php 755 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\core\model;
  9. use think\Config;
  10. use think\Db;
  11. use think\Exception;
  12. use think\Log;
  13. use think\Model;
  14. use tool\Common;
  15. class Master extends Model
  16. {
  17. protected $resultSetType = 'collection';
  18. protected $updateTime = 'updateTime';
  19. protected $createTime = 'addTime';
  20. protected $autoWriteTimestamp = true;
  21. public function createPassword($password) {
  22. return md5('aisdfa90asopdf0as8d0f8a0s9d8f0asdfjasdfaqw'.$password);
  23. }
  24. public function createToken() {
  25. return md5(THINK_START_TIME.Common::token_create(10));
  26. }
  27. public function createTokenOverTime() {
  28. return (int)THINK_START_TIME + 7 * 86400;
  29. }
  30. }